Jump to content

problem with multiple files upload


yami007

Recommended Posts

When I click the link to add the file values disappear, what can i do to prevent this??

this is my code so far

<html>
<head>
	<title>Add multiple uploads</title>
	<script language="javascript">
		<!--
		var clicks = 1;

		function clicked() {
			document.getElementById('clicked').value = ++clicks;
		}

		function writeToDoc() {
			text = 'File '+clicks+' <input type="file" size="70" name="file_'+clicks+'" /><br/>';
			document.getElementById('1').innerHTML = document.getElementById(1).innerHTML += text;
		}
		//-->
	</script>
</head>
<body>
	<a href="javascript:writeToDoc()" onclick="clicked()">Add</a>
	<form name="upload">
		<div id="1">

			File 1 <input type="file" size="70" name="file_1" /><br/>
		</div>
	</form>
</body>
</html>

Link to comment
https://forums.phpfreaks.com/topic/183126-problem-with-multiple-files-upload/
Share on other sites

Because the type="file" value can only be set by the browser's file select dialog box, you cannot use standard methods of adding fields by rewriting all the values. You must insert/add fields. Here is a link to script that shows how to do this - http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/

Because the type="file" value can only be set by the browser's file select dialog box, you cannot use standard methods of adding fields by rewriting all the values. You must insert/add fields. Here is a link to script that shows how to do this - http://the-stickman.com/web-development/javascript/upload-multiple-files-with-a-single-file-element/

thanks i read that article, it's cool.

but I wonder if there's a way to keep the values in the file, i saw this on a page.

and i just want to do it as simple as my code!!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.