tags:

views:

119

answers:

1

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

+1  A: 

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

eCaroth
I need the extra fields to insert data about the file into a mysql database and I am uploading to s3 directly using post.
Abdul Latif
There are 2 ways you can do it then, if you want to have the form fields that you need in the same form as the amazon upload form. Either way you have to have a javascript hook for when the form is submitted. The first way you could do it is to use strictly JS to capture the elements you need and format it into a GET style string, then append that to the end of the return url you specify in the amazon POST. Then when that return script is called, you have the values the user entered in the query string to work with.
eCaroth
Secondly, you could use JS to get the values from the field and use AJAX to get that information into your database before the form actually posts to Amazon.EITHER WAY you will have to either remove the fields or append the names with "x-ignore-" before posting it to amazon or you will receive an error.
eCaroth