<html>
<head>
<script language="javascript">
fields = 0;
function addInput() {
if (fields != 10) {
document.getElementById('files').innerHTML += "<br /><input type='file' value='' name='file[]' />";
fields += 1;
} else {
document.getElementById('files').innerHTML += "<br /><span style=\"color:red;\">You can only have 10 upload fields.</span>";
document.upload.add.disabled=true;
}
}
</script>
<title>Upload File</title>
</head>
<body>
<form name="upload" enctype="multipart/form-data" action="uploader.php" method="POST">
<div id="files">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <br /><input name="file[]" type="file" />
</div><br />
<input type="submit" value="Upload File" />
<input type="button" value="Add more" name="add" onclick="addInput()" />
</form>
</body>
</html>
I have this HTML and a javascript that creates extra file upload fields at the user's choice. I want to be able to upload these to my server. I know how to upload one file but I can't get it to upload all the files that I want to upload.
Can anyone help?
Thanks,
~James


Sign In
Create Account


Back to top









