HOW CAN I UPLOAD FILES ASYNCHRONOUSLY WITH JQUERY?

How can I upload files asynchronously with jQuery?

The “enctype” has to be mentioned in the AJAX call.

For example:

$(document).ready(function ( ) {
$(“#uploadbutton”).click(function ( ) {
var filename = $(“#file”).val(
);
$.ajax({
type: “POST”,
url: “addFile.do”,
enctype: ‘multipart/form-data’,
data: {
file: filename
},
success: function
( ) {
alert(“Data Uploaded: “);
}
});
});
});

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>