【问题标题】:Do not display file in browser when using Google Cloud Storage: ALWAYS DOWNLOAD使用 Google Cloud Storage 时不要在浏览器中显示文件:始终下载
【发布时间】:2012-07-28 22:13:48
【问题描述】:

我刚开始使用带有 Rails 3 应用程序的 Google Cloud Storage。我可以使用 Carrierwave 成功地将文件上传到我的存储桶,但我希望在单击链接时始终下载文件并且永远不要直接在浏览器中呈现。

我知道使用 Dropbox,您只需将“?dl=1”添加到下载链接的末尾,它就会一直下载。 Google Cloud Storage 是否有任何此类 URL 约定?提前致谢。

【问题讨论】:

    标签: ruby-on-rails-3 carrierwave google-cloud-storage


    【解决方案1】:

    在做了一些进一步的研究之后,看起来您必须自己修改 HTTP 标头以用于 Content-Disposition。

    https://developers.google.com/storage/docs/reference-headers#contentdisposition

    【讨论】:

      猜你喜欢
      • 2020-06-21
      • 1970-01-01
      • 2019-05-25
      • 1970-01-01
      • 1970-01-01
      • 2018-10-17
      • 2019-08-26
      • 2022-11-11
      • 1970-01-01
      相关资源
      最近更新 更多