1

I'm looking for a mechanism by which to ajax-submit a rather complex form. Think "email in a browser". I have multiple "dropboxes" to allow users to drag-and-drop file attachments, but I also need to submit other form elements simultaneously. Therefore I need to queue the file items as opposed to immediately sending them on drop.

I've seen 100,000,001 blog posts and SO threads on how to handle drag and drop. I've got that covered. The issue is that of submitting the full form together as opposed to uploading files independently then submitting the remainder of the form.

I've looked at FormData, but the examples i've encountered seem to require an "old school" file input. And since you can't manipulate a file input in JS that mechanism doesn't seem to be useful to me.

I've considered staggering the operations (e.g. submit the main portion of the form, and on success submit the files behind it with a separate XMLHttpRequest and FileReader, but I'd rather do it all together if possible).

Also, it would be nice to have a solution that supports IE, but frankly FF and Safari are sufficient. Any assistance would be appreciated. Hopefully I'm overlooking something simple. Thanks in advance.

humble_coder
  • 2,777
  • 7
  • 34
  • 46
  • Was http://stackoverflow.com/questions/5392344/sending-multipart-formdata-with-jquery-ajax one of the 100,000,001? It seems like it covers what you're looking for. – ultranaut Oct 11 '12 at 01:28
  • It was indeed. It's one of the many that requires a file input (as opposed to drag and drop). Based on my current data, it seems that we have a choice between using the "old" file input and having a manual button, or using drag and drop without the ability to submit other data. Thanks for the quick reply though! – humble_coder Oct 11 '12 at 01:32
  • Ah, I see, I was wondering what "old school" file meant. – ultranaut Oct 11 '12 at 01:34
  • Apologies. I had the word "input" surrounded by brackets. Apparently SO didn't like it and hid it. Fixed now. – humble_coder Oct 11 '12 at 01:36

0 Answers0