I am using HTML5 Drag&Drop File Upload with c# asp.net . In all browsers everything work fine, but in IE10 I can't get the files in the server in order to save them. I've tried everything and nothing works. please help.
here is my code:
javascript & HTML:
function uploadFile(index) {
var files = window.opener.files;
for (var i = index; i < (index + files.length); i++) {
debugger;
var size = fixSize(files.item(i - index).size);
var name = files.item(i - index).name;
xhr.push(new XMLHttpRequest());
var data = new FormData();
data.append("index", i);
data.append("fileName", name);
data.append("file", files.item(i - index));
xhr[i].open('POST', "HandlerUploadFiles.ashx", true);
xhr[i].send(data);
}
}
c#, using IHttpHandler:
public class HandlerUploadFiles : IHttpHandler, IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
string fileName = context.Request["fileName"];
string postedFile = context.Request["file"];
HttpFileCollection fileCollection = context.Request.Files;
...
}
}
The problem in IE:
The server side code hits at ProcessRequest function.
The error I get while debugging: the collection : context.request.Files is empty (count=0) .
However, the other strings values (like fullName) from XHR can be retrieved .
I thought maybe I don't send the file correctly, but in searches I did - this was the way to send it.
Like I mention before- in FF and Chrome the program works excellent
Thanks for any help.