3

我想将Content-Disposition标题添加到我使用carrierwave 上传的文件中(以后不能通过URL 中的查询参数来执行此操作)。

在上传文件之前,我可以在模型中添加什么来AttachmentUploader帮助我完成此任务吗?

谢谢!

4

1 回答 1

9

您可以在 Carrierwave 配置中全局设置属性 -

CarrierWave.configure do |config|
  config.fog_attributes = {'Content-Disposition' => ...}
end

或者您可以在上传程序类本身上定义它

def fog_attributes
  {'Content-Disposition' => ...}
end

并且上传者上的方法可以使用上传者可访问的数据来确定fog_attributes的适当返回值

于 2013-11-08T04:19:17.277 回答