我无法在IE中使用fineuploader上传图片。适用于chorme和FireFox。
任何想法为什么在IE中上传jpg都行不通。我注意到chrome请求对象Context类型是“application / octet-stream”而IE不是。这是问题,如果是这样,我将更改以使fineuploader在请求中使用此上下文类型。
由于 //设置上传器。 if(document.getElementById('formUpload')){ var description =“”; var fileName =“”; var fileUploader = new qq.FileUploader({
allowedExtensions: viewModel.AllowedFileExt(),
element: document.getElementById('formUpload'),
action: '../Upload/UploadHandler.ashx',
params: {
submissionNumber: function () {
submissionNumber = $("#SubmissionNumber").val();
return submissionNumber;
},
fileName: function () {
fileName = $(".qq-upload-file").text();
return fileName;
},
description: function () {
description = $("#txtAttachmentDesciption").val();
return description;
}
},
onComplete: function (id, fileName, responseJSON) {
$("#attachedFiles").html("");
loadAttachments($("#Number").val());
},
onSubmit: function (id, fileName) {
fileUploader.filesSelectedForUpload = 1;
},
autoUpload: false,
multiple: false
});
fileUploader.filesSelectedForUpload = 0;
}
答案 0 :(得分:0)
问题是服务器端。 在IE中使用“context.Request.Files [”qqfile“]。InputStream”not context.Request.InputStream
//if IE
var buffer = new byte[context.Request.ContentLength];
using (var br = new BinaryReader(context.Request.Files["qqfile"].InputStream))
br.Read(buffer, 0, buffer.Length);
//ELSE
var buffer = new byte[context.Request.ContentLength];
using (var br = new BinaryReader(context.Request.InputStream))
br.Read(buffer, 0, buffer.Length);