I have a form that allows for multiple file uploads.
<input name="uploadedfile[]" type="file" multiple="true"/>
Now, I want to validate it using javascript to check if a file was selected. I tried the following but failed
if(form.uploadedfile.length < 1)
{
alert("You Forgot to select an image");
return false;
}
and I know its an array but i also tried
if(form.uploadedfile.value == '')
{
alert("You Forgot to select an image");
return false;
}
can someone help me out on this one.
Thanks
In this example they use a files property of the input, and check the length of that, something like this.
And the JS:
Haven’t been able to find any info about the files-property yet.