I use a signed S3 authorized download so that users can upload files directly from their browser to S3 bypassing my server. This currently works, but the file name matches the username. I would like to save it on S3 as another name.
The forms I submit to amazon look like this:
var formData = new FormData(); formData.append('key', targetPath); // eg /path/inside/bucket/myFile.mov formData.append('AWSAccessKeyId', s3Auth.AWSAccessKeyId); // aws public key formData.append('acl', s3Auth.acl); // eg 'public-read' formData.append('policy', s3Auth.policy); // s3 policy including ['starts-with', '$key', '/path/inside/bucket/'] formData.append('signature', s3Auth.signature); // base64 sha1 hash of private key and base64 policy JSON formData.append('success_action_status ', 200); // response code 200 on success formData.append('file', file.slice()); // eg /path/on/user/computer/theirFile.mov
However, instead of a file ending in: https://s3.amazonaws.com/mybucket/path/inside/bucket/myFile.mov
It ends as: https://s3.amazonaws.com/mybucket/path/inside/bucket/theirFile.mov
Note that it has a file name, but my base path.
I would like it to have a file name, which I also specify.
Update: Update: this worked all the time. I just had a different code copied from one bucket to another, which restored the original file name and thus confused me.
source share