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';
};