Change the file name for the user when booting directly from AWS S3

I am developing an application where I will store files on S3. Due to the fact that the file names may be different, I have to rename the files to something common in the bucket, so I know which one to get later.

If I allowed the user to download through my web application, I could change the file name before sending it to the user. However, I want the user to directly download the file using a temporary protected token, such as below.

s3 = AWS::S3.new(
  :access_key_id => 1234,
  :secret_access_key => abcd
)
object = s3.buckets['bucket'].objects['path/to/object']
object.url_for(:get, { :expires => 20.minutes.from_now, :secure => true }).to_s

But how to change the file name that the user sees when loading this file back to the original file name?

+4
source share
1 answer

Content-disposition S3 attachment; filename="nameyouwant", nameyouwant - , , , , . S3 -, Content-disposition URL-.

+6

All Articles