uploading files progress bar using javascript

Classico

New Member
I have the following codes:\[code\]function ProgressBar() { if (document.getElementById('<%=ImageFile.ClientID %>').value != "") { document.getElementById("divProgress").style.display = "block"; document.getElementById("divUpload").style.display = "block"; id = setInterval("progress()", 20); return true; } else { alert("Select a file to upload"); return false; } } function progress() { size = size + 1; if (size > 299) { clearTimeout(id); } document.getElementById("divProgress").style.width = size + "pt"; document.getElementById("<%=lblPercentage.ClientID %>").firstChild.data = http://stackoverflow.com/questions/15460388/parseInt(size / 3) +"%"; }\[/code\]However I have a problem: Currently i am uploading files not using a fileupload control but using javascript as well that allows multiple uploading that add a file input:\[code\]function AddFileInput() { var tdFileInputs = document.getElementById('tdFileInputs'); var id = (new Date()).getTime(); var file = document.createElement('input'); file.setAttribute('id', id); file.setAttribute('name', id); file.setAttribute('type', 'file'); tdFileInputs.appendChild(file); var a = document.createElement('a'); a.setAttribute('id', 'remove_' + id); a.innerHTML = "Remove<br>"; a.onclick = RemoveFileInput; tdFileInputs.appendChild(a); var lnkAttch = document.getElementById('lnkAttch'); count = count + 1; if (count > 0) { lnkAttch.innerHTML = "Attach another file"; document.getElementById("btnSend").style.display = ""; } else { document.getElementById("btnSend").style.display = "none"; lnkAttch.innerHTML = "Attach a file"; }}\[/code\]How do i change the codes at ProgressBar() to use the function addFileInput()Please help!
 
Top