Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#12411 closed defect (fixed)

[patch] dojox.form.uploader.plugins.HTML5 : form field name is hard-coded to "uploadedfiles"

Reported by: talisto Owned by: Kenneth G. Franqueiro
Priority: high Milestone: 1.6.1
Component: DojoX Form Version: 1.6.0
Keywords: Cc:
Blocked By: Blocking:

Description

the dojox.form.Uploader should use the "name" attribute for the form field name, however the HTML5 plugin has the field name hardcoded to "uploadedfiles".

The default name in Uploader.js is "uploadedfile", and the HTML5's field name should be plural, so the name in the HTML5 plugin should actually be this.name + 's'.

I've attached a patch file to resolve the issue.

Attachments (1)

HTML5.js.patch (539 bytes) - added by talisto 8 years ago.

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by talisto

Attachment: HTML5.js.patch added

comment:1 Changed 8 years ago by bill

Owner: changed from dante to Mike Wilcox
Summary: dojox.form.uploader.plugins.HTML5 : form field name is hard-coded to "uploadedfiles"[patch] dojox.form.uploader.plugins.HTML5 : form field name is hard-coded to "uploadedfiles"

It's a trivial patch, we don't need a CLA (although please file one if you give bigger patches, thanks!)

comment:2 Changed 8 years ago by Mike Wilcox

Resolution: fixed
Status: newclosed

(In [24003]) Fixes #12411 - fixed hard coded form name in the HTML5 uploader.

comment:3 Changed 8 years ago by bill

Milestone: tbd1.7

comment:4 Changed 8 years ago by talisto

Resolution: fixed
Status: closedreopened

Unfortunately this isn't entirely fixed yet; the forEach loop needs "this" scope, so the following needs to be changed (line 94):

dojo.forEach(this.inputNode.files, function(f, i){
        fd.append(this.name+"s[]", f);
});

to:

dojo.forEach(this.inputNode.files, function(f, i){
        fd.append(this.name+"s[]", f);
},this);

I s'pose this would have been easier if I hadn't bungled my previous patch (I diff'ed in the wrong order, d'ohh).

comment:5 Changed 8 years ago by Adam Peller

Milestone: 1.71.6.1

ok for inclusion in 1.6.1 (before Apr 13)

comment:6 Changed 8 years ago by Kenneth G. Franqueiro

Owner: changed from Mike Wilcox to Kenneth G. Franqueiro
Status: reopenednew

[24248] by mwilcox fixes the issue raised yesterday by talisto in trunk (man, trac's really falling asleep at the helm tonight).

I'll port both changes to 1.6.

comment:7 Changed 8 years ago by Kenneth G. Franqueiro

Resolution: fixed
Status: newclosed

(In [24252]) Porting [24003] and [24248] to honor name attribute in Uploader, to 1.6 branch. Fixes #12411

comment:8 Changed 7 years ago by Irfan Ahmed

I am uploading multiple files to a servlet (MultipartHandler?). The issue I am seeing is that all files have a name as uploadedFiles[] in the disposition line instead uploadedFiles[0], uploadedFiles[1] and so on.

Now if I change

fd.append(this.name+"s[]", f);

to

fd.append(this.name+"s[" + i "]", f);

the it works fine. What I wanted to know was whether this is a bug or should the Multipart handler servlet handle this.

Last edited 7 years ago by Irfan Ahmed (previous) (diff)
Note: See TracTickets for help on using tickets.