amazon s3 - S3 Post Policy key not honoring folders -
i'm trying s3 html uploads working, i'm trying hard code define key name rather use ${filename}
. controlled api server, when specify key folder separators , it's uploaded it's converted html entities of %2f
.
so have post policy of this:
{ "expiration": "2017-01-01t00:00:00z", "conditions": [ {"bucket": "mybucket"}, {"key": "i/1/1.png"}, {"acl": "public-read"}, {"content-type": "image/png"}, ["content-length-range", "0", "1048576"] ] }
using html form so:
<html> <head> <title>s3 post form</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <body> <form action="https://mybucket.s3.amazonaws.com/" method="post" enctype="multipart/form-data"> <input type="hidden" name="key" value="i/1/1.png"> <input type="hidden" name="awsaccesskeyid" value="aws_access_key_id"> <input type="hidden" name="acl" value="public-read"> <input type="hidden" name="policy" value="base64 policy"> <input type="hidden" name="signature" value="signature"> <input type="hidden" name="content-type" value="image/png"> <!-- include additional input fields here --> file upload s3: <input name="file" type="file"> <br> <input type="submit" value="upload file s3"> </form> </body> </html>
when file uploaded ends file name of:
https://mybucket.s3.amazonaws.com/i%2f1%2f1.png
so question is, how /
literal folder separator?
ok, i'm idiot. i've learned s3 both %2f
, /
valid folder separators.