Hey there,
You need to make sure, you have done the things described below:
1- Add
enctype="multipart/form-data"
property in the form tag of your page.
2- I create an example to see how it works, follow it in your own code:
aspx:
<asp:fileupload runat="server" id="file" onchange="upload();" />
Jquery:
function upload() {
var fileUpload = $("#file").get(0);
var files = fileUpload.files;
var data = new FormData();
for (var i = 0; i < files.length; i++) {
data.append(files[i].name, files[i]);
}
$.ajax({
dataType: 'json',
type: 'POST',
processData: false,
contentType: false,
url: '/AjaxFileUpload/AjaxUpload.ashx',
data: data,
success: function (response) {
alert("posted");
}
});
}
Replace the URL with your own URL of handler and the ID of the FileUpload control, and you are good to go.
[Edit]Use latest JQuery library in your application to make it work.[/Edit]
Cheers.
Let me know if it helps.
Azee...