solved!I can't give a full, absolute path name to the file when using `send_file`. I *have* to give a path relative to the 'public' directory. Changing the path to relative to 'public' sends the file alright.Could this *please* be listed in *bold* in the documentation for `send_file`?
Many thanks,
On Monday, January 3, 2011 at 7:09 PM, Puneet Kishor wrote:
This is driving me nuts, so I would appreciate any advice. Perhaps it is just a silly oversight on my part.punkish@Lucknow ~/Sites/carbonapp/public/images/models/2bau/years/8$pwd/Users/punkish/Sites/carbonapp/public/images/models/2bau/years/8punkish@Lucknow ~/Sites/carbonapp/public/images/models/2bau/years/8$ls 2*2010_nep.gifpunkish@Lucknow ~/Sites/carbonapp/public/images/models/2bau/years/8$So, as you can see, the following file exists/Users/punkish/Sites/carbonapp/public/images/models/2bau/years/8/2010_nep.gifMy route isget '/:model_id/year/:year/zoom/:zoom/:output' => sub {my $model_id = params->{model_id};my $year = params->{year};my $zoom = params->{zoom};my $output = params->{output};# get model_file based on model_idmy $dir = config->{'app_dir'} . '/' . config->{'img_dir'} . "/$model_file/years/$zoom";my $img = $year . '_' . $output . '.gif';debug("sending '$dir/$img'");send_file("$dir/$img");};My development.log shows[37838] debug @0.008607> [hit #1] sending '/Users/punkish/Sites/carbonapp/public/images/models/2bau/years/8/2010_nep.gif' in /Users/punkish/Sites/carbonapp/lib/carbonapp/models.pm l. 106and yet, I get the following error in my browser{"error":"No such file: `/Users/punkish/Sites/carbonapp/public/images/models/2bau/years/8/2010_nep.gif'"}
Please point me to my stupid ways.
_______________________________________________
Dancer-users mailing list
Dancer-users@perldancer.org
http://www.backup-manager.org/cgi-bin/listinfo/dancer-users