I'm trying to restrict file types to image files in my upload page using javascript... I can use something like this for one particular file: <!-- Begin extArray = new Array(".gif", ".jpg", ".png"); function LimitAttach(form, file) { allowSubmit = false; if (!file) return; while (file.indexOf("\\") != -1) file = file.slice(file.indexOf("\\") + 1); ext = file.slice(file.indexOf(".")).toLowerCase(); for (var i = 0; i < extArray.length; i++) { if (extArray == ext) { allowSubmit = true; break; } } if (allowSubmit) form.submit(); else alert("Please only upload files that end in types: " + (extArray.join(" ")) + "\nPlease select a new " + "file to upload and submit again."); } // End --> ************BUT*********** I have 5 file inputs on a form and the 'name' on all of these is 'upload[]' and if i use 'ipload[]' in the javacode, it does not work... Is there a way to filter any/all of the selected files using javascript? I'm trying to save my users time by limiting their choices and alerting them of an unsupported file type before uploading... Thank you for your assistance, Mike
give each of the fields a unique id and use the document.getElementById("id").value to retrieve the values of the fields.