mojolicious

88 views
Skip to first unread message

harihara...@jothisoftware.com

unread,
Jun 7, 2016, 7:39:01 AM6/7/16
to Mojolicious
hi ,
  i have doub't on upload a  read csv file and show that read file in a console using mojolicious framework.for understanding cilent server interactions. please can any one help me . this is my code
sub welcome {
my  $self=  shift;

     # Check file size
     return  $self->render(text=>  'File is too big.', status=>  200)
       if  $self->req->is_limit_exceeded;

     # Process uploaded file
     my  $file=  $self->req->upload('_file');
     my  $upload=  Mojo::Upload->new;

     $upload->move_to('//');

    my  $size=  $upload->size;
     my  $name=  $upload->filename;

     $self->render(text=>  "Thanks for uploading $size byte file $name.");

}

it is showing an error in
Can't call method "move_to" on an undefined value at /usr/local/share/perl5/Mojo/Upload.pm line 6.

how to print the variable in the form action ="".

Pavel K

unread,
Jun 7, 2016, 9:11:20 AM6/7/16
to Mojolicious
It's more easy than you think:
Remove this code
     my  $upload=  Mojo::Upload->new;
And use $file
 $filename = $file->filename;
$size = $file->size;

$file->move_to('/path/here/to/file.csv');

вторник, 7 июня 2016 г., 14:39:01 UTC+3 пользователь harihara...@jothisoftware.com написал:
Reply all
Reply to author
Forward
0 new messages