[dancer-users] Code behaves differently on digitalocean.

Stefan Hornburg (Racke) racke at linuxia.de
Sun Jan 10 07:48:43 GMT 2016


On 01/10/2016 03:35 AM, Richard Reina wrote:
> This code works (the file uploads) when I run it from my web app on my local host. However, it does not when I try it on the digitalocean version of my app. I get no errors and $file->copy_to($destination) returns true. But the file does not upload. Anyone have an idea as to what the problem could be?
> 
> post '/upload' => sub {
> 
>     my $user_id = session 'UID';
>     my $d_filename = 'user_' . $user_id . '.jpg';
>    
>     my $file = request->upload('file');
>         my $tmpname = $file->tempname;
>         my $destination = $upload_dir . '/' . $d_filename;
>         my ($crslt) = $file->copy_to($destination) || warn $!;
>         unlink $tmpname if -e $tmpname;
> 
>         debug "crslt: ", $crslt;
>    
>       template 'upload';
> 
>     redirect '/playerdash';
> };
> 

Where did you define $upload_dir and what is the value of it?

Regards
	Racke


-- 
Perl and Dancer Development

Visit our Perl::Dancer conference 2015.
More information on https://www.perl.dance.



More information about the dancer-users mailing list