Sending multipart/formdata with jQuery.ajax

Starting with Safari 5/Firefox 4, it’s easiest to use the FormData class: var data = new FormData(); jQuery.each(jQuery(‘#file’)[0].files, function(i, file) { data.append(‘file-‘+i, file); }); So now you have a FormData object, ready to be sent along with the XMLHttpRequest. jQuery.ajax({ url: ‘php/upload.php’, data: data, cache: false, contentType: false, processData: false, method: ‘POST’, type: ‘POST’, // … Read more

jQuery Ajax File Upload

File upload is not possible through AJAX. You can upload file, without refreshing page by using IFrame. You can check further details here. UPDATE With XHR2, File upload through AJAX is supported. E.g. through FormData object, but unfortunately it is not supported by all/old browsers. FormData support starts from following desktop browsers versions. IE 10+ … Read more

How can I upload files to a server using JSP/Servlet?

Introduction To browse and select a file for upload you need a HTML <input type=”file”> field in the form. As stated in the HTML specification you have to use the POST method and the enctype attribute of the form has to be set to “multipart/form-data”. <form action=”upload” method=”post” enctype=”multipart/form-data”> <input type=”text” name=”description” /> <input type=”file” … Read more