hobojjr Posted September 4, 2006 Share Posted September 4, 2006 hiI found this code to upload multiple files[code]foreach ($_FILES["pictures"]["error"] as $key => $error) { $name = $_FILES["pictures"]["name"][$key]; if ($error == UPLOAD_ERR_OK) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; move_uploaded_file($tmp_name, $uploadDir.$name);....[/code]it works fine for 1-5 small files but when i try to upload 10 photos i get invalid agrument in foreach call...anyone know whats going on? Quote Link to comment Share on other sites More sharing options...
radar Posted September 4, 2006 Share Posted September 4, 2006 Have a shot at this.. this is a script i found a while ago though havent tested.. you may have to edit it a little bit but should give you a decent start... Its totally different than what you've got an has 0 error checking.. but that could be changed.. i hope this helps even the slightest..upload form:[code]<?php<table width = "500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC"><tr><form action="multiple_upload_ac.php" method="post" enctype="multipart/form-data" name="form1" id="form1"><td><table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF"><tr><td><strong>Multiple Files Upload</strong></td></tr><tr><td>Select File: <input name="ufile[]" type="file" id="ufile[]" size="50" /></td></tr><tr><td>Select File: <input name="ufile[]" type="file" id="ufile[]" size="50" /></td></tr><tr><td>Select File: <input name="ufile[]" type="file" id="ufile[]" size="50" /></td></tr><tr><td align="center"><input type="submit" name="Submit" value="Upload" /></td></tr></table></td></form></tr></table>?>[/code]processing script:[code]<?phpecho $HTTP_POST_FILES['ufile']['name'][0];echo "<br>";echo $HTTP_POST_FILES['ufile']['name'][1];echo "<br>";echo $HTTP_POST_FILES['ufile']['name'][2];echo "<br>";?>[/code]Something along those lines should help.. you might have to play with it a bit to get it to have the functionality you want... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.