Try using:
my $upload = $self->req->upload('_file');
On 11/06/2012 05:14 PM, Renato Forti wrote:
> Hi All,
>
> I'm trying upload a file, but my file data is not 'moved' to dir! The file
> is created, but with 0kb. See my code! I am using normal app (no Lite App)!
>
> First in :
>
> sub startup {
> # ...
> $r->post('/upload')->to('services#upload');
> # ...
> }
>
> Now, in Services.pm
>
> sub upload
> {
> 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->param('_file');
> my $upload= Mojo::Upload->new;
>
> $upload->move_to('/hades/temp/zones/sa/east/1b/temp/foo.txt');
>
> my $size= $upload->size;
> my $name= $upload->filename;
>
> $self->render(text=> "Thanks for uploading $size byte file $name.");
> }
>
> What is wrong!!!?
>
> Anoter question: How do I can put a loadding bar on File Updload Web Page! Any Idea?
>
> Thanks
> --
> You received this message because you are subscribed to the Google Groups
> "Mojolicious" group.
> To view this discussion on the web visit
>
https://groups.google.com/d/msg/mojolicious/-/h2hxPjHnNJAJ.
> To post to this group, send email to
mojol...@googlegroups.com.
> To unsubscribe from this group, send email to
>
mojolicious...@googlegroups.com.
> For more options, visit this group at
>
http://groups.google.com/group/mojolicious?hl=en.
--
Ben van Staveren
phone: +62 81 70777529
email:
benvans...@gmail.com