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?
source
share