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 пользователь
[email protected] написал:
>
> 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 ="".*
>
>
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.