[dancer-users] Image Uploader

Richard Reina gatorreina at gmail.com
Sun Sep 6 04:01:19 BST 2015


2015-09-05 20:30 GMT-05:00 Richard Reina <gatorreina at gmail.com>:

>
>
> 2015-09-05 17:46 GMT-05:00 Russell Jenkins <
> russell.jenkins at strategicdata.com.au>:
>
>> On 6/09/2015 7:54 am, Richard Reina wrote:
>>
>>> post '/upload' => sub {
>>>     my $file = request->upload('file');
>>>         my $fname = $file->filename;
>>>         my $tmpname = $file->tempname;
>>>         my $destination = $upload_dir . '/' . $fname;
>>>         $file->copy_to($destination);
>>>         unlink $tmpname if -e $tmpname;
>>>
>>>     print "Done\n";
>>> };
>>>
>>>
>> Note that `print` returns true if successful.
>>
>> The `print` statement is the last one in your route, and the returned
>> value from a route becomes the response content.
>>
>> Hope that helps,
>>   Russell.
>>
>> Hi Russell,
>
> Thanks for the reply. I continue to get the same result after I comment
> out the print statement.
>

I think the problem was that I forgot to put template 'upload' in the post
subroutine.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.preshweb.co.uk/pipermail/dancer-users/attachments/20150905/ef6e8e0a/attachment.html>


More information about the dancer-users mailing list