+ 1
Set the number of file allowed to be uploaded
How to set limit on the number of file to upload( let say a max of 3 files)
8 Antworten
+ 2
From:
https://stackoverflow.com/questions/18201811/how-can-restrict-user-to-upload-max-10-files-at-once
<input id="files" type="file" name="files[]" multiple="multiple" onchange="checkFiles(this.files)">
function checkFiles(files) {
if(files.length>10) {
alert("length exceeded");
files.slice(0,10);
return false;
}
}
+ 2
Set a flag and a counter
For each action, increase counter by one
When counter reaches three, set the flag as true
Enclose the action in a checking and execute only when the flag is false.
+ 2
JS
var flag = false;
var counter = 0;
if (!flag) {
...do something...
if(++counter==3){flag=true;}
}
+ 2
Sorry I don't know about form.
I hope someone else can help you.
0
ok
0
please can you write some code.appreciate
0
<form>
<input type=“file” name=“file[]” multiple>
</form>
please add the js handler to the form
0
thanks