Allow uploading all files of an <input type="file" multiple>

Description

Currently, you have two possibilities to upload files, fileUpload() and fileUploadAll() (resp. <cffile action="fileupload"> and <cffile action="fileuploadall">). The former allows you to upload a single file of a given form field, the latter uploads all files of a request.

Unfortunately, fileUpload() only uploads a single file of the given form field, even when you have set the multiple attribute on the <input type="file">. fileUploadAll(), on the other side, uploads all files of the whole form, which may be spread over multiple <input type="file"> elements, which you may want to handle differently.
There is no option to handle all the files - and just those - of a single <input type="file" multiple>.

So I suggest to either change the functionality of fileUpload() to handle all the files of a given field and output an array of structs like fileUploadAll() does. If changing the default behavior causes compatibility problems, then this could be controlled via an additional argument multiple, defaulting to false.

Activity

Show:
Sebastian Zartner
August 8, 2018, 11:27 PM

Corresponding Adobe ColdFusion ticket:
https://tracker.adobe.com/#/view/CF-4203252

Zac Spitzer
August 9, 2018, 7:51 AM

We could also add an attribute to fileUploadAll which lets you restrict which form fields are processed?

Sebastian Zartner
August 9, 2018, 10:50 AM

> We could also add an attribute to fileUploadAll which lets you restrict which form fields are processed?

That would be another option, though I found it more intuitive to make the change to fileUpload(), because that function is already restricted to a single form field. Allowing to restrict fileUploadAll() seems to be against its name.

Zac Spitzer
August 9, 2018, 1:35 PM

fair point, that does makes sense

You also prompted me to improve the Lucee docs to explicitly mention that fileUploadAll supports multiple files and processes all the files in form fields in the request, thanks!
http://docs.lucee.org/reference/functions/fileuploadall.html

Sebastian Zartner
August 9, 2018, 7:44 PM

Thank you for updating the docs!

Assignee

Unassigned

Reporter

Sebastian Zartner

Labels

Priority

New
Configure