3

I'm having trouble getting the BlueImp jQuery file upload plugin to work correctly in IE. It works correctly in all other browsers tested. Specifically, the problem I'm having is that the "done" function isn't getting data back from my handler (ASP.NET/C#). When I write the data that the done function sends out to the console, the "result" property is null in IE. All of the solutions I've seen so far say to either set the ContentType to "text/plain" or to make sure that the data returned is an array. I've done both of these things.

This is the string returned from the server (found by capturing network activity in IE9's developer tools):

 [{"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"}]

These are the response headers:

    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

This is the data returned by the "done" function:

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]
OmegaX
  • 91
  • 1
  • 7
  • possible duplicate of [blueimp jquery file upload - "done", "complete" callbacks not working for IE 9](http://stackoverflow.com/questions/10122165/blueimp-jquery-file-upload-done-complete-callbacks-not-working-for-ie-9) – Paul Sweatte Sep 22 '14 at 23:38
  • I never did find a solution for this. I made a hacky work-around, by adding a service endpoint that would return the ID I needed. It's hacky because it's just returning the last ID created for a file with the given name. This solution is alright, in my case, because the system is used pretty infrequently. YMMV – OmegaX Sep 25 '14 at 16:09

0 Answers0