Need Help to create dynamic file upload box
Posted: Mon Nov 29, 2010 10:21 am
Hello,
I have created a form and on that i have a text box and a button just enter the number of items to add in text box and click on add it will add but now i have a problem that i want to get names of files .
Here is my code:
javascript function:
if(typeof(raju)=='undefined')
{
raju={};
}
raju.Gen=function(count)
{
var div=document.getElementById("MyDiv");
var content="";
for(var i=1;i<=count;i++)
{
var image = "imgnew"+i ;
content+="<br/><input type='file' name=image id='img'+i /><br/>";
}
div.innerHTML=content;
}
Form elements:
<input type="text" name="imgcnt" id="txtCount" onchange="raju.Gen(this.value);" />
<input type="button" id="btnGen" value="Add Upload Images" />
<td id="MyDiv">
</td>
Now i want to take every files by its name but unable to get the names of files.
I have created a form and on that i have a text box and a button just enter the number of items to add in text box and click on add it will add but now i have a problem that i want to get names of files .
Here is my code:
javascript function:
if(typeof(raju)=='undefined')
{
raju={};
}
raju.Gen=function(count)
{
var div=document.getElementById("MyDiv");
var content="";
for(var i=1;i<=count;i++)
{
var image = "imgnew"+i ;
content+="<br/><input type='file' name=image id='img'+i /><br/>";
}
div.innerHTML=content;
}
Form elements:
<input type="text" name="imgcnt" id="txtCount" onchange="raju.Gen(this.value);" />
<input type="button" id="btnGen" value="Add Upload Images" />
<td id="MyDiv">
</td>
Now i want to take every files by its name but unable to get the names of files.