Amazon S3 File Uploads
I can upload files from a form using post, but I am trying to find out how to add extra fields to the form i.e File Description, Type and etc.
Also can I upload more than one file at once, I know it says you can't using post in the documentation but are there any work arounds?
Thanks in Advance
In regards to uploading multiple files, are you uploading directly to S3 using POST, or posting to s3 using CURL or a similar lib from your own server?
Why are you adding these extra inputs? If posting directly to S3, you cannot post any inputs that aren't specified as required or optional in the S3 documentation. Any form elements that don't start with "x-ignore-" and aren't required/optional for S3 post upload WILL cause an error to be returned from S3, without uploading your file. If you have elements in the form that can cause this error and they are important to leave in the form before it is submitted (being used as input for an ajax call, etc), then simply append the name of these form elements with "x-ignore-" or delete them from the form.
You have control over a few things, such as the name the file is served with and type by usign the Content-Type and Content-Disposition elements. Take a look at this: http://developer.amazonwebservices.com/connect/entry.jspa?externalID=1434
You can append your additional information to the "return url" you send alongside your request to Amazon.
Be aware that doing this may expose sensitive information about your app logic to the user in the form of an URL. One thing you can do to avoid/hide this is to capture all GET variables on return, save them, and redirect user to a summary page.
This won't block smarter users form learning your GET variables, but will hide them from 99% of the public.
精彩评论