我用HTTPXMLRequest调用webservice方法。但是asp.net webservice中的context.request.files
计数为零!我该如何解决?
这是我的ajax请求代码:
....
var files = event.originalEvent.dataTransfer.files;
upload(files)
/* ---------------------------------------------------- */
function upload(files) {
for (var i = 0; i < files.length; i++) {
xhr = new XMLHttpRequest();
xhr.upload.addEventListener('progress', uploadProgress, false);
xhr.onreadystatechange = stateChange;
xhr.open('POST', "WebService.asmx/HelloWorld", true);
xhr.setRequestHeader('X-FILE-NAME', files[i].name);
xhr.send(files[i]);
}
}