2016-01-10 9:55 GMT-06:00 Andrew Beverley <[email protected]>: > On Sun, 2016-01-10 at 07:39 -0600, Richard Reina wrote: > > $upload_dir was being set just before the get route -- which I realize > > is not correct > > As an aside, it's probably best practice to define in your config file, > rather than hard-coding into your code. That won't be a cause of your > problem though. > > > post '/upload' => sub { > > > > my $upload_route = '/upload'; > > my $upload_dir = 'public/profile_pics'; > > Have you tried using an absolute path? Or even tried something with open > permissions like "/tmp"? > > > my $user_id = session 'UID'; > > my $d_filename = 'user_' . $user_id . '.jpg'; > > > > my $file = request->upload('file'); > > my $tmpname = $file->tempname; > > debug "File Size: ", $file->size; > > debug "file: ", $file->filename; > > debug "tmpname: ", $file->tempname, > > my $destination = $upload_dir . '/' . $d_filename; > > debug "Destination: $destination\n"; > > my ($crslt) = $file->copy_to($destination) || warn $!; > > Do you get any warnings here? TBH, I don't even know if the precedence > of the operators there will work correctly. I would always use "or" > instead of "||" in a situation like that. > > It would also be worth doing a "warn 'test'" to check that your warnings > are being logged somewhere that you can see them. > > Andy >
Andy, Thanks for the ideas. Absolute paths worked. Thanks again everybody for the helpful replies.
_______________________________________________ dancer-users mailing list [email protected] http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
