franknu Posted January 20, 2007 Share Posted January 20, 2007 ok i have this code but i been trying to get it to work for weeks, i want to upload multiple files and save the path in the database, PLEASE HELPMy error message is: picture one uploadedPicture2 uploadedWarning: Wrong parameter count for move_uploaded_file() in /home/townsfin/public_html/html_forms/insert_data.php on line 134[code=php:0]define ("$uploaddir", "/home/townsfin/public_html/business_images/");// $uploadfile1 = $_FILES['Picture1']['name'];if(isset ($_FILES['Picture1'])){ If (is_uploaded_file($_FILES['Picture1']['tmp_name'])&& is_uploaded_file($_FILES['Picture2']['tmp_name']));{ // $fullpath1 = $uploaddir . $uploadfile1;$today=date("m-d-y"); $filename1=$_POST['name']. "1";$result= move_uploaded_file($_FILES['Picture1']['tmp_name'], $uploaddir .$filename1); if($result==1){ echo"picture one uploaded";}$uploadfile2= $_FILES['Picture2']['name'];//$fullpath2=$uploaddir . $uploadfile2; $filename2= $_POST['name']. "2"; $result = move_uploaded_file($_FILES['Picture2']['tmp_name'], $uploaddir .$filename2); if ($result==1) { echo"Picture2 uploaded";} if (move_uploaded_file ($_FILES['Picture1']['tmp_name']) && ($_FILES['Picture2']['tmp_name']. $uploaddir)){ $sql="INSERT INTO `business_info`(`BusinessName`,`Slogan`,`Business_Address`,`Tel`,`Website`,`Email`, `Fax`,`type`,`make`,`Categories`,`Keyword`,`Picture1`,`Headline`,`Slogan2`,`Description1`,`Description2`,`Description3`, `Picture2`,`Picture3`,`User_Name`,`Password`)Values('$BusinessName','$Slogan','$Business_Address','$Tel','$Website','$Email','$Fax','$type','$make','$Categories','$Keyword','$fullpath1','$Headline','$Slogan2','$Description1','$Description2','$Description3','$fullpath2','$fullpath1','$User_Name','$Password')"; mysql_query($sql)or die(mysql_error());}}}?>[/code] Link to comment https://forums.phpfreaks.com/topic/34999-uploading-multiple-files-path-in-the-database/ Share on other sites More sharing options...
Jessica Posted January 20, 2007 Share Posted January 20, 2007 Change: define ("$uploaddir", "/home/townsfin/public_html/business_images/");to $uploaddir = "/home/townsfin/public_html/business_images/";add this to the top and show what it displays:print '<pre>';print_r($_FILES);print_r($_POST);print '</pre>'; Link to comment https://forums.phpfreaks.com/topic/34999-uploading-multiple-files-path-in-the-database/#findComment-165066 Share on other sites More sharing options...
franknu Posted January 20, 2007 Author Share Posted January 20, 2007 i am getting a parser errorParse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/townsfin/public_html/html_forms/insert_data.php on [code=php:0] if (move_uploaded_file ($_FILES['Picture1']['tmp_name']) && ($_FILES['Picture2']['tmp_name'], "$uploaddir"))[/code][code=php:0]$uploaddir= "/home/townsfin/public_html/business_images/" ;// $uploadfile1 = $_FILES['Picture1']['name'];if(isset ($_FILES['Picture1'])){ If (is_uploaded_file($_FILES['Picture1']['tmp_name'])&& is_uploaded_file($_FILES['Picture2']['tmp_name']));{ // $fullpath1 = $uploaddir . $uploadfile1;$today=date("m-d-y"); $filename1=$_POST['name']. "1";$result= move_uploaded_file($_FILES['Picture1']['tmp_name'], $uploaddir .$filename1); if($result==1){ echo"picture one uploaded";}$uploadfile2= $_FILES['Picture2']['name'];//$fullpath2=$uploaddir . $uploadfile2; $filename2= $_POST['name']. "2"; $result = move_uploaded_file($_FILES['Picture2']['tmp_name'], $uploaddir .$filename2);';print_r($_FILES);print_r($_POST);print ''; if ($result==1) { echo"Picture2 uploaded";} if (move_uploaded_file ($_FILES['Picture1']['tmp_name']) && ($_FILES['Picture2']['tmp_name'], "$uploaddir")){ $sql="INSERT INTO `business_info`(`BusinessName`,`Slogan`,`Business_Address`,`Tel`,`Website`,`Email`, `Fax`,`type`,`make`,`Categories`,`Keyword`,`Picture1`,`Headline`,`Slogan2`,`Description1`,`Description2`,`Description3`, `Picture2`,`Picture3`,`User_Name`,`Password`)Values('$BusinessName','$Slogan','$Business_Address','$Tel','$Website','$Email','$Fax','$type','$make','$Categories','$Keyword','$fullpath1','$Headline','$Slogan2','$Description1','$Description2','$Description3','$fullpath2','$fullpath1','$User_Name','$Password')"; mysql_query($sql)or die(mysql_error());}}}?>[/code] Link to comment https://forums.phpfreaks.com/topic/34999-uploading-multiple-files-path-in-the-database/#findComment-165071 Share on other sites More sharing options...
franknu Posted January 20, 2007 Author Share Posted January 20, 2007 picture one uploadedArray ( [Picture1] => Array ( [name] => chicken1.jpg [type] => image/pjpeg [tmp_name] => /tmp/phpyAHJGB [error] => 0 [size] => 300291 ) [Picture2] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [Picture3] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [Picture4] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) [Picture5] => Array ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) ) Array ( [First_Name] => [Last_Name] => [Owner_Address] => [State] => [City] => [Zip] => [Tel] => [Email] => [Position] => [Comments] => [BusinessName] => [Member_Status] => [Slogan] => [Website] => [Keyword] => [Fax] => [Business_Address] => [make] => Massachusetts [type] => Lawrence [Categories] => [Headline] => [Slogan2] => [Description1] => [Description2] => [Description3] => [Contact2] => [User_Name] => [Password] => ) Warning: Wrong parameter count for move_uploaded_file() in /home/townsfin/public_html/html_forms/insert_data.php on line 137i addedprint_r($_FILES); that is my display now Link to comment https://forums.phpfreaks.com/topic/34999-uploading-multiple-files-path-in-the-database/#findComment-165088 Share on other sites More sharing options...
Jessica Posted January 20, 2007 Share Posted January 20, 2007 So see how picture 2 has no tmp_name? That's why you're getting an error. There is no picture 2. Check the logic - make sure your code is indented so you can follow it easily. Link to comment https://forums.phpfreaks.com/topic/34999-uploading-multiple-files-path-in-the-database/#findComment-165134 Share on other sites More sharing options...
franknu Posted January 21, 2007 Author Share Posted January 21, 2007 ok this is my error now please helpWarning: Wrong parameter count for move_uploaded_file() in /home/towdf/dfdfd Link to comment https://forums.phpfreaks.com/topic/34999-uploading-multiple-files-path-in-the-database/#findComment-165824 Share on other sites More sharing options...
franknu Posted January 21, 2007 Author Share Posted January 21, 2007 i added this if (move_uploaded_file ($_FILES['Picture1']['tmp_name']. $uploaddir) && ($_FILES['Picture2']['tmp_name']. $uploaddir))but still the same problem Link to comment https://forums.phpfreaks.com/topic/34999-uploading-multiple-files-path-in-the-database/#findComment-165918 Share on other sites More sharing options...
franknu Posted January 22, 2007 Author Share Posted January 22, 2007 ok now it says everything has been uploaded but nothing shows on the databasehere is my new changes[code=php:0]define ("$uploaddir", "/home/townsfin/public_html/business_images/"); $uploadfile1 = $_FILES['Picture1']['name'];if(isset ($_FILES['Picture1'])){ If (is_uploaded_file($_FILES['Picture1']['tmp_name'])&& is_uploaded_file($_FILES['Picture2']['tmp_name']));{ $fullpath1 = $uploaddir . $uploadfile1;$today=date("m-d-y"); $filename1=$_POST['name']. "1";$result= move_uploaded_file($_FILES['Picture1']['tmp_name'], $uploaddir .$filename1); if($result==1){ echo"picture one uploaded";}$uploadfile2= $_FILES['Picture2']['name'];$fullpath2=$uploaddir . $uploadfile2; $filename2= $_POST['name']. "2"; $result = move_uploaded_file($_FILES['Picture2']['tmp_name'], $uploaddir .$filename2);print_r($_FILES); if ($result==1) { echo"Picture2 uploaded";} if (move_uploaded_file ($_FILES['Picture1']['tmp_name'], $uploaddir)) { $sql="INSERT INTO `business_info`(`BusinessName`,`Slogan`,`Business_Address`,`Tel`,`Website`,`Email`, `Fax`,`type`,`make`,`Categories`,`Keyword`,`Picture1`,`Headline`,`Slogan2`,`Description1`,`Description2`,`Description3`, `Picture2`,`Picture3`,`User_Name`,`Password`)Values('$BusinessName','$Slogan','$Business_Address','$Tel','$Website','$Email','$Fax','$type','$make','$Categories','$Keyword','$fullpath1','$Headline','$Slogan2','$Description1','$Description2','$Description3','$fullpath2','$fullpath1','$User_Name','$Password')"; mysql_query($sql)or die(mysql_error());}}}?>[/code] Link to comment https://forums.phpfreaks.com/topic/34999-uploading-multiple-files-path-in-the-database/#findComment-165987 Share on other sites More sharing options...
franknu Posted January 22, 2007 Author Share Posted January 22, 2007 my error is[code=php:0]warning: Wrong parameter count for move_uploaded_file()[/code] Link to comment https://forums.phpfreaks.com/topic/34999-uploading-multiple-files-path-in-the-database/#findComment-166431 Share on other sites More sharing options...
franknu Posted January 22, 2007 Author Share Posted January 22, 2007 Please help Link to comment https://forums.phpfreaks.com/topic/34999-uploading-multiple-files-path-in-the-database/#findComment-166569 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.