2

We are using carrierwave + aws S3 to upload file, and we need provide a download function.

For solution 1, we use:

= link_to "Download", file.doc.url, download: file.original_name

And it does not work under IE8, click the link will open this file(image).

According to This, I should add Content-Disposition header,

Then I check aws S3 document, Found I need add response-content-disposition to file.doc.url,

Is there any way I can do this in carrierwave, or I could use other ways? Thanks for your help.

Community
  • 1
  • 1
linjunhalida
  • 4,538
  • 6
  • 44
  • 64

1 Answers1

4

Got it, for fu = FileUploader.new, we can use:

fu.url(query: {"response-content-disposition" => "attachment;"})

Read tons of documents and source code.

linjunhalida
  • 4,538
  • 6
  • 44
  • 64