views:

229

answers:

1

Hi guys, I am trying to make my Rails app support resuming of downloads, since we serve quite large files from there. I found a piece of middleware to do this long ago, but I cant find it again. Any tips/tricks on how to pull it off?

Thanks! :)

A: 

This was how I did it:

response.header["Accept-Ranges"] = "bytes"
send_file product.pack.path, :type => product.pack_content_type, :x_sendfile=>true

I asked our server guy to set up mod_xsendfile, I don't know how to set it myself.

Tutorial here: http://www.devsource.com/c/a/Techniques/Resumable-File-Downloads-with-ASPNet/2/

Read about content-length here: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13

About streaming is available here: http://api.rubyonrails.org/classes/ActionController/Streaming.html

jaycode