php - File input problems - Limit number of selected files -


i'm putting 2 questions in "question"...

1) first of all, have <input type="file" name="file[]" multiple="multiple" />, can select many images want, need limit number 10 maximally. how this?

2) upload.php file handle multiple uploaded images? never had chance work on more single image uploading, i'm stuck @ , need this. i'm quite confused...

help please?

1 use javascript detect number of files selected, , give warning if it's more 10

$('fileinput').onchange=function(){if(this.files.length>10)alert('to many files')} //prevent submitting if many $('form').onsubmit=function(){if(this.files.length>10)return false;} 

you check if combined filesize isn't big adding .files[i].filesize

2 see: http://php.net/manual/en/features.file-upload.multiple.php (short version; use: $_files['userfile']['name'][0], $_files['userfile']['tmp_name'][0], $_files['userfile']['size'][0], , $_files['userfile']['type'][0])


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -