I have this form below.
<form id="upload_form" enctype="multipart/form-data" method="post">
<input type="text" name="name[]" id="name"><br>
<input type="text" name="name[]" id="name"><br>
<input type="file" name="file1" id="file1"><br>
<input type="button" value="Upload File" onclick="uploadFile()">
</form>
and this is my function uploadFile.
function uploadFile(){
var file = _("file1").files[0];
var name = _("name").value;
alert(name);
var formdata = new FormData();
formdata.append("file1", file);
formdata.append("name", name);
Now my problem is I want to get the value of my textbox array which is the name[]..when I try to alert the name variable only the first index is showing up..any help will be appreciated.thanks in advance..
input type=textas an array? you can simply get it from the.valueprop...._()?function _(e){ return document.getElementById(e); }