Wrong file format and size when the file is downloaded (using rails send_file method).

Jérémy Dierx jeremy.dierx at pickabee.com
Fri Aug 3 17:28:56 MSD 2007


Sorry for my english...

I have a Ruby on Rails site in production with Nginx 0.5.15 and 2
mongrel clusters. All work fine except the file download (streaming) and
i don't know where does the problem come from (mongrel ? nginx ?
rails ?)

In my view, I have the link : link_to "my_file", 
{:controller=>"environnement", :action=>"download", :id=>"my_file"} 

In the action of my controller environnement, I use the send_file
method :
"public/my_file.pdf", :type => 'application/pdf' 

In my browser, when I click on the download link pointing to the action,
the browser window says that it is starting the download and after 30s
it says
that the download is finished. 

-> there is no progress bar in the download window of the browser. 

-> when the file is downloaded, the format isn't correct and the size of
it is not what it should be

-> it's work localy on my desktop in development mode

-> it works if i use the direct link without the send_file method :

Here the logs from production.log :

Processing EnvironnementController#download (for 82.247.51.xxx at 
2007-07-31 17:27:03) [GET] 
  Session ID: 32b17304de1110d9aeebb602439fe056 
  Parameters: {"action"=>"download", "id"=>"my_file", 
Completed in 0.00057 (1754 reqs/sec) | Rendering: 0.00006 (10%) | DB: 
0.00000 (0%) | 200 OK 
Streaming file public/my_file.pdf 

an idea ?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx/attachments/20070803/cb012414/attachment.html>

More information about the nginx mailing list