Monday, June 3, 2013

Submit a form having File input via ajax

Googling the topic of the post would give the link to stackoverflow which suggests . http://jquery.malsup.com/form. However , I missed this plugin , and started researching-

A list of options  -
1) Hidden Iframes -
        Didnt know anything about form submit through Iframes. Eventually found the promising plugin jQuery.AjaxFileUpload from J.Feldstein. But this was helpful in submitting only individual fields, one by one. It uses hidden iframes, where it wraps the field with the form and submits it to iframe using the target attribute. There is some hack that I havent yet understood. (Here).

2) Form-Data/ Xhr2 -  
       This is a clean implementation of HTML5. Easy 2 liners and form is submitted with file inputs. But it was not implemented in every browser, and lesser number of mobile browsers, so ..didnt go ahead with that.