views:

209

answers:

0

I am having trouble putting files onto my S3 account using http post. Everything is working great, but I want the key and filename to be different. I'm specifying the key just fine and my policy doc is working fine too. I include this line in my policy doc

["starts-with", "$Content-Disposition", ""]

and this is the input for my Content-Dispositon value, just like they specify in the documentation:

<input type="hidden" name="Content-Disposition" value="attachment; filename=${filename}">

EXCEPT when I actually submit the form the filename is getting messed up. It ends when a special character or space is encountered. I know when you specify content-disposition as a header the filename is encapsulated by quotes, but I obviously can't do that in an html input element. I tried using javascript to write the value and url encode the filename. That works and preserves the whole filename but when I serve the file from S3 with a custom url (files are private, I have to sign the url). The url-encoded characters don't get UNencded. There is absolutely NO documentation for this, and it's driving me crazy!

I assumed that by using the ${filename} variable in the input value that S3 would automatically encode the filename... HELP!