Opened 6 years ago

Closed 3 years ago

#17461 closed defect (patchwelcome)

[dojox/form/Uploader] does not submit as an AJAX post/response in IE 8 or 9.

Reported by: sbedoll Owned by:
Priority: undecided Milestone: 1.13
Component: DojoX Uploader Version: 1.9.1
Keywords: Cc:
Blocked By: Blocking:

Description

version 1.9.1 of 'dojox/form/Uploader' does not submit as an AJAX post/response in IE 8 or 9.

In 1.8 version of the code used Iframe for IE and the Ajax Post worked fine. However, now in 1.9.1 the Post is not using Ajax.

The Post works as before (with the added uploadType) but the response is picked up by IE as a text file download and the Uploader widget never completes. I noticed the warning about requiring the IFrame plugin but the behavior is the same whether I require it or not.

The HTML5 support works as before (ie from Chrome) and the Post is Ajaxified.

Change History (5)

comment:1 Changed 6 years ago by bill

Component: DojoX FormDojoX Uploader

comment:2 in reply to:  description Changed 6 years ago by sbedoll

Replying to sbedoll:

version 1.9.1 of 'dojox/form/Uploader' does not submit as an AJAX post/response in IE 8 or 9.

In 1.8 version of the code used Iframe for IE and the Ajax Post worked fine. However, now in 1.9.1 the Post is not using Ajax.

The Post works as before (with the added uploadType) but the response is picked up by IE as a text file download and the Uploader widget never completes. I noticed the warning about requiring the IFrame plugin but the behavior is the same whether I require it or not.

The HTML5 support works as before (ie from Chrome) and the Post is Ajaxified.

I recently tested this with IE 10 and the problem did not occur. I am assuming IE 10 is supporting the HTML 5 upload plugin and the IFrame plugin is the issue.

comment:3 Changed 5 years ago by sbedoll

My customer requires this capability to work for IE 8/9. Is there someone who can help me debug this? I investigated further and found the callback provided to the "then" method is not invoked when the response is received in the Upload IFrame context.:

uploadIFrame: function(data){

summary: Internal. You could use this, but you should use upload() or submit(); which can also handle the post data.

var

formObject = {}, sendForm, form = this.getForm(), url = this.getUrl(), self = this;

data = data
{};

data.uploadType = this.uploadType;

create a temp form for which to send data enctype can't be changed once a form element is created sendForm = domConstruct.place('<form enctype="multipart/form-data" method="post"></form>', this.domNode); arrayUtil.forEach(this._inputs, function(n, i){

don't send blank inputs if(n.value !== ){

sendForm.appendChild(n); formObject[n.name] = n.value;

}

}, this);

add any extra data as form inputs if(data){

formObject = domForm.toObject(form); for(nm in data){

if(formObject[nm] === undefined){

domConstruct.create('input', {name:nm, value:data[nm], type:'hidden'}, sendForm);

}

}

}

request.post(url, {

form: sendForm, handleAs: "json", content: data

}).then(function(result){

domConstruct.destroy(sendForm);

if(dataERROR?
dataerror?){

self.onError(result);

}else{

self.onComplete(result);

}

}, function(err){

console.error('error parsing server result', err); domConstruct.destroy(sendForm); self.onError(err);

});

}

});

comment:4 Changed 5 years ago by sbedoll

I did some more testing and found a scenario that worked where setting the HttpServletResponse? Content-Type to "text/html" instead of "application/json" when the IFrame plugin is employed on the client drives the upload complete event correctly.

comment:5 Changed 3 years ago by dylan

Milestone: tbd1.12
Resolution: patchwelcome
Status: newclosed

Given the lack of attention that dojox/form/Uploader has received, I'm closing this ticket as patchwelcome. If you would like to work on a fix, please create a pull request and reopen the ticket.

Note: See TracTickets for help on using tickets.