JQuery BlueImp文件上传插件在IE中返回null结果

时间:2012-01-03 17:10:50

标签: javascript jquery internet-explorer file-upload

我无法让BlueImp jQuery文件上传插件在IE中正常运行。它在所有其他测试的浏览器中都能正常工具体来说,我遇到的问题是“完成”函数没有从我的处理程序(ASP.NET / C#)中获取数据。当我写完成函数发送到控制台的数据时,IE中的“result”属性为null。到目前为止,我看到的所有解决方案都说要将ContentType设置为“text / plain”,要么确保返回的数据是一个数组。我已经完成了这两件事。

这是从服务器返回的字符串(通过捕获IE9开发人员工具中的网络活动找到):

 [{"file":[{"Thumbnail_url":null,"Name":"Tulips.jpg","Length":620888,"Type":"image/jpeg","Hash":"54c2f1a1eb6f12d681a5c7078421a5500cee02ad","Title":"Picture of Tulips","URL":"http://files.cityoffargo.com/content/54c2f1a1eb6f12d681a5c7078421a5500cee02ad/Tulips.jpg"}],"sizef":"620888","name":"Tulips.jpg","file_length":"606.34","file_hash":"54c2f1a1eb6f12d681a5c7078421a5500cee02ad","url":"http://files.cityoffargo.com/content/54c2f1a1eb6f12d681a5c7078421a5500cee02ad/Tulips.jpg","title":"Picture of Tulips"}]

这些是响应标题:

    Key Value
Response    HTTP/1.1 200 OK
Date    Tue, 03 Jan 2012 17:05:17 GMT
Server  Microsoft-IIS/6.0
X-Powered-By    ASP.NET
X-AspNet-Version    4.0.30319
Cache-Control   private
Content-Type    text/plain; charset=utf-8
Content-Length  506

这是“完成”功能返回的数据:

LOG: {
disabled : false,
dropZone : [object Object],
replaceFileInput : true,
singleFileUploads : true,
sequentialUploads : false,
forceIframeTransport : false,
multipart : true,
recalculateProgress : true,
formData : [object Object],[object Object],
add : function (e, data) {                 var that = $(this).data('fileupload');                 that._adjustMaxNumberOfFiles(-data.files.length);                 data.isAdjusted = true;                 data.isValidated = that._validate(data.files);          ,
processData : false,
contentType : false,
cache : false,
autoUpload : false,
minFileSize : 1,
acceptFileTypes : /.+$/i,
previewFileTypes : /^image\/(gif|jpeg|png)$/,
previewMaxWidth : 80,
previewMaxHeight : 80,
previewAsCanvas : true,
uploadTemplate : [object Object],
downloadTemplate : [object Object],
dataType : "iframe json",
send : function (e, data) {                 if (!data.isValidated) {                     var that = $(this).data('fileupload');                     if (!data.isAdjusted) {                         that._adjustMaxNumberOfFiles(-data.files.length);                ,
done : function (e, data) {                                 var that = $(this).data('fileupload');                 if (data.context) {                     data.context.each(function (index) {                         var file = ($.isArray(data.result) &&                    ,
fail : function (e, data) {                 var that = $(this).data('fileupload');                 that._adjustMaxNumberOfFiles(data.files.length);                 if (data.context) {                     data.context.each(function (index) {                     ,
progress : function (e, data) {                 if (data.context) {                     data.context.find('.ui-progressbar').progressbar(                         'value',                         parseInt(data.loaded / data.total * 100, 10)                     );   ,
progressall : function (e, data) {                 $(this).find('.fileupload-progressbar').progressbar(                     'value',                     parseInt(data.loaded / data.total * 100, 10)                 );             },
start : function () {                 $(this).find('.fileupload-progressbar')                     .progressbar('value', 0).fadeIn();             },
stop : function () {                 $(this).find('.fileupload-progressbar').fadeOut();             },
destroy : function (e, data) {                 var that = $(this).data('fileupload');                 if (data.url) {                     $.ajax(data)                         .success(function () {                             that._adjustMaxNumberOfFiles(1);      ,
fileInput : [object Object],
files : [object Object],
form : [object Object],
originalFiles : [object Object],
submit : function () {                     return (that._trigger('submit', e, newData) !== false) &&                         that._onSend(e, newData);                 },
isAdjusted : true,
isValidated : true,
context : [object Object],
paramName : "files[]",
url : "[myurl]/upload.ashx",
type : "POST",
uploadedBytes : 0,
lengthComputable : true,
loaded : 1,
total : 1,
result : null,
textStatus : "success",
jqXHR : [object Object]

0 个答案:

没有答案