Opened 7 years ago

Closed 7 years ago

#16796 closed defect (fixed)

[regression] dojox/form/Uploader.upload optional parameter

Reported by: lzboron Owned by: Mike Wilcox
Priority: high Milestone: 1.9
Component: DojoX Uploader Version: 1.8.3
Keywords: Cc:
Blocked By: Blocking:

Description

According to documentation and comments function 'upload' of dojox/form/Uploader has one optional parameter 'formData', but it contains this code:

formData.uploadType = this.uploadType;

Also function 'uploadIFrame' in 'uploader/_IFrame.js' and function 'uploadFlash' in 'uploader/_Flash.js' contain similar code, which fails, when no parameter is provided.

Older versions of Uploader (1.7) did not require this parameter.

Change History (10)

comment:1 Changed 7 years ago by bill

Component: DojoX FormDojoX Uploader
Owner: changed from dante to Mike Wilcox

comment:2 Changed 7 years ago by dylan

Milestone: tbd1.9
Priority: undecidedhigh

This one looks like a fairly strong regression.

comment:3 Changed 7 years ago by bill

Summary: dojox/form/Uploader.upload optional parameter[regression] dojox/form/Uploader.upload optional parameter

comment:4 Changed 7 years ago by Mike Wilcox

Resolution: fixed
Status: newclosed

In [30850]:

Fixes #16796

comment:5 Changed 7 years ago by lzboron

I do not think this is fixed. I upload files programatically by calling upload function on uploader. This function looks like this:

//Uploader.js
upload: function(/*Object?*/ formData){				
	// summary:
	//	When called, begins file upload. Only supported with plugins.
	formData.uploadType = this.uploadType;
	this.inherited(arguments);
},
//_Flash.js
uploadFlash: function(/*Object ? */ formData){
	// summary:
	//	Uploads selected files. Alias "upload()" should be used instead.
	// tags:
	//	private
	this.onBegin(this.getFileList());
	formData.returnType = "F";
	formData.uploadType = this.uploadType;
	console.log('flas upload', formData);
	this.flashMovie.doUpload(formData);
},
//_IFrame.js
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.uploadType = this.uploadType;
...
}

All these functions will fail if no formData is provided.

You can also see test dojox/form/tests/test_Uploader_programmatic.html. Click upload button in dialog and you will get error.

comment:6 Changed 7 years ago by Mike Wilcox

In [30864]:

Fixes #16796 - ensuring forData object

comment:7 Changed 7 years ago by Mike Wilcox

Ok, it wasn't clear what you were asking for. I think this fixes it.

comment:8 Changed 7 years ago by lzboron

Thank you for fix, it works well for HTML5 upload. Same check should be added to IFrame and Flash plugins, because they override Uploader's upload function with their uploadIFrame and uploadFlash functions.

comment:9 Changed 7 years ago by bill

Resolution: fixed
Status: closedreopened

Reopening to get fix in plugins (assuming above comment is valid).

comment:10 Changed 7 years ago by dylan

Resolution: fixed
Status: reopenedclosed

In [31125]:

fixes #16796, make sure IFrame and Flash plugins don't break if data is not provided

Note: See TracTickets for help on using tickets.