[Dancer-users] sending file fails

franck franck at lumberjaph.net
Tue Jan 4 08:36:42 CET 2011


On Tue, Jan 4, 2011 at 3:01 AM, Puneet Kishor <punk.kish at gmail.com> wrote:

>  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`?
>
>
done! thanks for the suggestion.


> Many thanks,
>
>  --
> Puneet Kishor
> Sent with Sparrow <http://www.sparrowmailapp.com>
>
> 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 at Lucknow ~/Sites/carbonapp/public/images/models/2bau/years/8$pwd
> /Users/punkish/Sites/carbonapp/public/images/models/2bau/years/8
> punkish at Lucknow ~/Sites/carbonapp/public/images/models/2bau/years/8$ls 2*
> 2010_nep.gif
> punkish at 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.gif
>
> My route is
>
> get '/: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_id
>
>     my $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. 106
>
> and 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.
>
>
>  --
> Puneet Kishor
> Sent with Sparrow <http://www.sparrowmailapp.com>
>
>
>
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110104/fd847db8/attachment.htm>


More information about the Dancer-users mailing list