PDA

View Full Version : Remove functionality in uploading files



ravivardhankatta
06-05-2008, 02:20 PM
I am using below code for uploading mutlipul files in app.but in that code remove functionality is not working.

please give me solution to solve this bug

function addEvent() {
var ni = document.getElementById('myDiv');
var numi = document.getElementById('theValue');
var num = (document.getElementById("theValue").value -1)+ 2;
numi.value = num;
var divIdName = "my"+num+"Div";
var newdiv = document.createElement('div');
newdiv.setAttribute("id",divIdName);
newdiv.innerHTML = '<p><input name="image[image_'+num+']" type="file" size="30" /><a href=\"javascript:;\" onclick=\"removeElement(\'"+divIdName+"\')\">Remove</a>;';
ni.appendChild(newdiv);
}

function removeElement(divNum) {
alert(divNum);
var d = document.getElementById('myDiv');
var olddiv = document.getElementById(divNum);
d.removeChild(olddiv);
}