Hello Experts,
Probably being thick - but here goes:
I have a few of these html inputs:
<form name="myform">
<input type="file" name="myfile[]" />
<input type="file" name="myfile[]" />
<input type="file" name="myfile[]" />
</form>
Open in new window
Using javascript, how do I output
a) the number of elements (3 in this case)
b) the values assigned to these elements.
I tried:
var files =document.myform.elements["myfile[]"];
for (i = 0; i < files.length; i++)
{
filename = files[i].value;
}
Open in new window
However, the file length is undefined.
I cannot change the name of the input variable from myfile[] for legacy reasons.
Many Thanks!
Open in new window