[Dancer-users] sending back an image
Puneet Kishor
punk.kish at gmail.com
Mon Jan 3 04:40:44 CET 2011
I think I had asked a variation of this question earlier, but I don't
have a clear resolution, so I ask again.
I have several folders full of images like so
foo/images/
1.gif
2.gif
3.gif
..
bar/images/
1.gif
2.gif
3.gif
..
I want to send a query like so `http://server/foo/1` or
`http://server/bar/3` and get back the correct image. So, I have the
following route
get '/:model/:model_id' => sub {
my $model_id = params->{model_id};
my $model = params->{model};
my $dir = '/Users/punkish/Sites/app/public';
my $img = "$model/images/$model_id.gif";
debug("sending '$dir/$img'");
send_file("$dir/$img");
};
I get the following message in my debug log
[90645] debug @0.009700> [hit #1] sending
'/Users/punkish/Sites/app/public/foo/images/1.gif' in ..
But, the browser says, "Firefox can't find the file at http://server/foo/1"
What gives?
--
Puneet Kishor http://punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Fellow http://creativecommons.org/about/people/fellows#puneetkishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
---------------------------------------------------------------------------
Assertions are politics; backing up assertions with evidence is science
===========================================================================
More information about the Dancer-users
mailing list