franknu Posted January 26, 2007 Share Posted January 26, 2007 ok this code is saving just the path to the database so when i ask for the picture to be display just the frame shows up no file, the file is not being uploaded in to the directory, If i upload or ftp the file manually it shows up when i ask for iti am not getting error message here is my code[code=php:0]define ("UPLOADDIR", "/home/townsfin/public_html/business_images/"); // All POST vars to vars.. $BusinessName = mysql_real_escape_string($_POST['BusinessName']); $Slogan = mysql_real_escape_string($_POST['Slogan']); //etc... IF ($_FILES['Picture1']) : $moved1 = false; $moved2 = false; $moved3 = false; IF (is_uploaded_file($_FILES['Picture1']['tmp_name'])) : $uploadfile1 = $_FILES['Picture1']['name']; $fullpath1 = UPLOADDIR . $uploadfile1; $filename1 = $_POST['name']. "1"; IF (move_uploaded_file($_FILES['Picture1']['tmp_name'], UPLOADDIR .$filename1)) : $moved1 = true; echo "picture $fullpath1 uploaded"; ENDIF; ENDIF; IF (is_uploaded_file($_FILES['Picture2']['tmp_name'])) : $uploadfile2= $_FILES['Picture2']['name']; $fullpath2 = UPLOADDIR . $uploadfile2; $filename2=$_POST['name']. "2"; IF (move_uploaded_file($_FILES['Picture2']['tmp_name'], UPLOADDIR .$filename2)) : $moved2 = true; echo "picture $fullpath2 uploaded"; ENDIF; ENDIF; IF (is_uploaded_file($_FILES['Picture3']['tmp_name'])) : $uploadfile3= $_FILES['Picture3']['name']; $fullpath3 = UPLOADDIR . $uploadfile3; $filename3=$_POST['name']. "3"; IF (move_uploaded_file($_FILES['Picture3']['tmp_name'], UPLOADDIR .$filename3)) : $moved3 = true; echo "picture $fullpath3 uploaded"; ENDIF; ENDIF; IF ($moved1 and $moved2 and $moved3) : $sql = "INSERT INTO `business_info` "; $sql .= "SET `BusinessName`= '$BusinessName', "; $sql .= " `Slogan`= '$Slogan', "; $sql .= " `Business_Address`= '$Business_Address', "; $sql .= " `Tel`= '$Tel', "; $sql .= " `Website`= '$Website', "; $sql .= " `Email`= '$Email', "; $sql .= " `Fax`= '$Fax', "; $sql .= " `type`= '$type', "; $sql .= " `make`= '$make', "; $sql .= " `Categories`= '$Categories', "; $sql .= " `Keyword`= '$Keyword', "; $sql .= " `Picture1`= '$fullpath1', "; $sql .= " `Headline`= '$Headline', "; $sql .= " `Slogan2`= '$Slogan2', "; $sql .= " `Description1`= '$Description1', "; $sql .= " `Description2`= '$Description2', "; $sql .= " `Description3`= '$Description3', "; $sql .= " `Picture2`= '$fullpath2', "; $sql .= " `Picture3`= '$fullpath3', "; $sql .= " `User_Name`= '$User_Name', "; $sql .= " `Password` = '$Password' "; mysql_query($sql)or die("SQL Error: $sql<br>" . mysql_error()); ENDIF; ENDIF; ?> [/code]here is my display[code=php:0]Array( [Picture1] => Array ( [name] => ph.jpg [type] => image/pjpeg [tmp_name] => /tmp/phpPyNvwo [error] => 0 [size] => 3224 ) [Picture2] => Array ( [name] => u-haul.jpg [type] => image/pjpeg [tmp_name] => /tmp/phpQMSbGo [error] => 0 [size] => 54074 ) [Picture3] => Array ( [name] => images.jpg [type] => image/pjpeg [tmp_name] => /tmp/phpBhuHAw [error] => 0 [size] => 4061 ) [Picture4] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [Picture5] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ))picture /home/townsfin/public_html/business_images/ph.jpg uploadedpicture /home/townsfin/public_html/business_images/u-haul.jpg uploadedpicture /home/townsfin/public_html/business_images/images.jpg uploaded "/home/townsfin/public_html/business_images [/code] Link to comment https://forums.phpfreaks.com/topic/35845-problem-moving-file-to-the-directory/ Share on other sites More sharing options...
franknu Posted January 26, 2007 Author Share Posted January 26, 2007 [code=php:0] this is the erea where the problem must beIF (is_uploaded_file($_FILES['Picture1']['tmp_name'])) : $uploadfile1 = $_FILES['Picture1']['name']; $fullpath1 = UPLOADDIR . $uploadfile1; $filename1 = $_POST['name']. "1"; IF (move_uploaded_file($_FILES['Picture1']['tmp_name'], UPLOADDIR .$filename1)) : $moved1 = true; echo "picture $fullpath1 uploaded"; ENDIF; ENDIF; [/code] Link to comment https://forums.phpfreaks.com/topic/35845-problem-moving-file-to-the-directory/#findComment-169986 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.