51
Views
3
Comments
Solved
[Multiple File Upload] Idea: add max files as an input
multiple-file-upload
Web icon
Forge asset by Multi Uploaders
Application Type
Traditional Web

Would be great to set a limit of how many files can be uploaded feature, any way around this without modifying the component? 

2019-03-18 10-26-38
Jeroen Vormer
Solution

@André Pinho :
You have to edit the "Private\JavaScriptNode" yourself:
With for example a variable 'MaxAmount' you can use this in the JavaScript.You cannot deny the end-user to select more files, but only prevent the upload of more than the maximum allowed:
You can for example change this:

if(filesProccessed == numberOfFiles){ //all files have been added to the JSON array

into:

if(filesProccessed == numberOfFiles || 
filesProccessed == MaxAmount 
){ //all files have been added to the JSON array

Also you have to prevent the 

reader.readAsDataURL(file);

to run when MaxAmount is reached.......


2023-06-14 08-52-52
Arkyadeep Bharadwaj

yes you can do.you can install the forge component in your environment and you can modify the component as per your requirement.

2019-03-18 10-26-38
Jeroen Vormer
Solution

@André Pinho :
You have to edit the "Private\JavaScriptNode" yourself:
With for example a variable 'MaxAmount' you can use this in the JavaScript.You cannot deny the end-user to select more files, but only prevent the upload of more than the maximum allowed:
You can for example change this:

if(filesProccessed == numberOfFiles){ //all files have been added to the JSON array

into:

if(filesProccessed == numberOfFiles || 
filesProccessed == MaxAmount 
){ //all files have been added to the JSON array

Also you have to prevent the 

reader.readAsDataURL(file);

to run when MaxAmount is reached.......


2018-08-04 18-19-00
André Pinho

Thanks both, I know this could be solved with JS, I guess this was a suggested approach to the component team to look into, rather than forking myself, or just in case I missed an obvious shortcut that avoided the modification of the component. Thank you for the detail Jeroen, maybe the component team can add this to their 'roadmap'.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.