CORS Amazon S3 file upload with jQuery Ajax request CORS Amazon S3 file upload with jQuery Ajax request ajax ajax

CORS Amazon S3 file upload with jQuery Ajax request


You can add more HTML tags <input type="file" name="uploadFile" /> because without file you can not post the file data using serialize() method. And I suggest you use serializeArray() instead of form.serialize().


Turns out that the error message displayed in the Chrome console had nothing to do with the actual error.

The problem was the jquery.serialize() does not save the file input because it is not supported in XMLHttpRequest (only in XMLHttpRequest 2). So the ajax request I was sending to S3 did not contain a file. Not sure why S3 was returning a CORS error, but once I switching to using FormData everything worked. Now I just have to figure out how to support IE 8 & 9... !