Using S3BrowserUpload to Add Form to a Content Type I have a content type with a machine name of "video" and I created a module called "df". I want to add a separate form to the content type (above or below the edit fields) that does a direct post to Amazon S3 using the S3BrowserUpload object from the AWS SDK. The steps I am trying to accomplish are:


Create additional upload form on "video" content type.
User enters information and specifies a file in the S3 upload form.
User clicks Save for the Add Content Type page.
Ajax fires the Amazon S3 POST form to upload the video file and handles the response to store the file's key path in a hidden field.
The normal drupal add content type fields are then posted back to the drupal site and processed. It would also have access to the hidden field that had been populated with Ajax.


I am new to Drupal forms so any assistance in integrating S3BrowserUpload with Drupal's forms API in my custom module to accomplish the steps above would be greatly appreciated.
Recently I worked on a project to integrate JW Player into a Drupal 7 site where the videos stream from an S3 bucket. There was also some Zencoder stuff going on but that is not really relevant here I don't think.

Currently we don't upload directly to S3 though, the project ran out of time before we could implement that. What the client does is upload the files directly to S3 and then reference the file in the content type using the Remote File Source module. That is not quite what you are trying to do though.

I have had a look around and see there is an Amazon S3 CORS Upload module which looks promising and might be able to help you. It creates a new form field #type which you can use in your module.

If none of that appeals to/works for you :) then you can use hook_form_alter to add a new custom upload field to the content type form, it is kind of messy but it will work. Then you add an extra submit handler to the form to catch your file. You can then use the code from this example to submit your file to S3.

The nicer way would be to create a new Field using the Drupal 7 Field API.