Hey Everyone,
Well what i am trying to do is basically you can upload multiple files. An well i want to be able to add "remove" to each file uploaded so in case the user decides they don't want to upload that file. Here is what i go so far
Here is the code
<script type="text/javascript">
var upload_number = 2;
function addFileInput()
{
var d = document.createElement("div");
var file = document.createElement("input");
file.setAttribute("type", "file");
file.setAttribute("name", "attachment"+upload_number);
d.appendChild(file);
var text = document.createElement("input");
text.setAttribute("type", "text");
text.setAttribute("name", "description"+upload_number);
document.getElementById("moreUploads").a...
document.getElementById("totalAttachment... = upload_number;
upload_number++;
}
</script>
heres the form
<input type="file" name="attachment1" id="attachments"
value="" onchange="document.getElementById('
moreUploadsLink')
.style.display = 'block';" />
Description <input type="text" name="description1"
id="description" value="" />
<div id="moreUploads"></div>
<div id="moreUploadsLink" style="display:none;">
<input type="button" value="Attach another file"
onclick="javascript:addFileInput();" >
</div>
<input type="hidden" id="totalAttachments" name="totalAttachments" value="1">
Thank you in advance
Rach
Tags: