mikefrederick Posted October 9, 2007 Share Posted October 9, 2007 help please, I can't figure out how to upload multiple files. I have the form w/ 2 upload fields called image1 and image2. Then I am using this script which will upload the file names to a database and it will upload the first file to a folder on the site called "propertyimages/" and I need to know how to make the script also copy the other file to the folder. here is the script, which contains some additional information being submitted to the db: <?php require_once "connect.php"; $filename = $HTTP_POST_FILES['image1']['name']; $filenametwo = $HTTP_POST_FILES['image2']['name']; $path= "../propertyimages/".$filename; $pathtwo= "../propertyimages/".$filenametwo; if (copy($HTTP_POST_FILES['image1']['tmp_name'], $path)) { $addname = $_POST['Addname']; $addemail = $_POST['Addemail']; $addphone = $_POST['Addphone']; $adddesc = $_POST['Adddesc']; $addact = $_POST['Addact']; $addrates = $_POST['Addrates']; $addamen = $_POST['Addamen']; mysql_select_db($database_localhost, $localhost); $query = "INSERT INTO addnew (addname,addemail,addphone,adddesc,addamen,addact,addrates,imageone,imagetwo) VALUES('$addname','$addemail','$addphone','$adddesc','$addamen','$addact','$addrates','$filename','$filenametwo')"; $Rs = mysql_query($query, $localhost) or die(mysql_error()); Header ('Location:index.php'); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/72383-uploading-multiple-files-w-php/ Share on other sites More sharing options...
mikefrederick Posted October 9, 2007 Author Share Posted October 9, 2007 anyone? pleaase help Quote Link to comment https://forums.phpfreaks.com/topic/72383-uploading-multiple-files-w-php/#findComment-365156 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.