briansykes Posted July 25, 2008 Share Posted July 25, 2008 Hello everyone i am trying to make a multiple file upload script and its not going well instead of moving the files it doesn't and then continuously adds rows to a myself DB table. the code is below. $query = mysql_query("INSERT INTO `listings` (state,name,location,price,typeofhome,bathrooms,bedrooms,basement,garage,features,remarks,lotsize,mlsid,hot) VALUES ('$status','$_POST[title]','$_POST[location]','$_POST[price]','$_POST[typeofhome]','$_POST[bathrooms]','$_POST[bedrooms]','$_POST[basment]','$_POST[garage]','$_POST[features]','$_POST[remarks]','$_POST[lot]','$_POST[mls]','$ishot')") or die("Failed because of ".mysql_error()); if ($query==TRUE) { $id = mysql_insert_id(); $tmp = md5(rand()); mkdir("pics/$tmp"); $upload_dir = "pics/$tmp/"; chmod($upload_dir,0777); mysql_query("UPDATE `listings` SET `imgloco` = '$upload_dir' WHERE `id` = '$id'"); $num = $_POST['picnum']; $i = 1; while ($i>=$num) { echo "hi"; $file_tmp = $_FILES['pic'.$i]['tmp_name']; $file_name = $_FILES['pic'.$i]['name']; $loco = $upload_dir.$file_name; move_uploaded_file($file_tmp,$loco); mysql_query("INSERT INTO `list_images` (lid,location) VALUES ('$id','$loco')"); $i++; } redirect("templates/dellisting.php"); } else { redirect("templates/addlisting.php"); } Link to comment https://forums.phpfreaks.com/topic/116511-multiple-file-upload-not-working/ Share on other sites More sharing options...
briansykes Posted July 25, 2008 Author Share Posted July 25, 2008 Any help that can be given in solving this bug is greatly appreciated and the directory the images go to is chmod 777 so i know thats not the problem, thanks for your time. Link to comment https://forums.phpfreaks.com/topic/116511-multiple-file-upload-not-working/#findComment-599121 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.