【问题标题】:Resuming file downloads in Ruby on Rails (Range: header support)在 Ruby on Rails 中恢复文件下载(范围:标头支持)
【发布时间】:2009-12-03 14:59:01
【问题描述】:

我正在尝试让我的 Rails 应用程序支持恢复下载,因为我们从那里提供相当大的文件。我很久以前找到了一个中间件来执行此操作,但我再也找不到了。关于如何实现它的任何提示/技巧?

谢谢! :)

【问题讨论】:

    标签: ruby-on-rails download resume-download


    【解决方案1】:

    我就是这样做的:

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

    我让服务员设置了mod_xsendfile,我自己不知道怎么设置。

    教程在这里:http://www.devsource.com/c/a/Techniques/Resumable-File-Downloads-with-ASPNet/2/

    在此处了解内容长度:http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.13

    关于流媒体可以在这里找到:http://api.rubyonrails.org/classes/ActionController/Streaming.html

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-08
    • 1970-01-01
    相关资源
    最近更新 更多