franknu Posted January 23, 2007 Share Posted January 23, 2007 I want to save some info along with two pictures the problem is that nothing is saving in the databasemy error message is Warning: Wrong parameter count for move_uploaded_file() PLEASE HELP!!![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";} // this is the line where i am getting error if (move_uploaded_file($_FILES['Picture2']['tmp_name']. $uploaddir .$filename2) && ($_FILES['Picture1']['tmp_name']. $uploaddir .$filename1)){ $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] Quote Link to comment https://forums.phpfreaks.com/topic/35371-not-saving-record-in-the-database/ Share on other sites More sharing options...
complex05 Posted January 23, 2007 Share Posted January 23, 2007 what does your form look like? Are you sure you have the correct enctype? Quote Link to comment https://forums.phpfreaks.com/topic/35371-not-saving-record-in-the-database/#findComment-167171 Share on other sites More sharing options...
trq Posted January 23, 2007 Share Posted January 23, 2007 This...[code=php:0]define ("$uploaddir", "/home/townsfin/public_html/business_images/");[/code]should be....[code=php:0]define ("UPLOADDIR", "/home/townsfin/public_html/business_images/");[/code]then change every instance of $uploaddir to UPLOADDIR in your script. Constants don't use $, and it is also good practice to capitalize them so they stand out. Quote Link to comment https://forums.phpfreaks.com/topic/35371-not-saving-record-in-the-database/#findComment-167179 Share on other sites More sharing options...
franknu Posted January 23, 2007 Author Share Posted January 23, 2007 <form enctype="multipart/form-data" action="insert_data.php" method="Post"><input name="Picture1" type="file" value=""> </td> </tr> <tr> <td>Picture 2 <input name="Picture2" type="file" value=""> </td> Quote Link to comment https://forums.phpfreaks.com/topic/35371-not-saving-record-in-the-database/#findComment-167188 Share on other sites More sharing options...
franknu Posted January 23, 2007 Author Share Posted January 23, 2007 SORRY LAST POST WAS MY HTML FORM I FORGOT TO SAY IT Quote Link to comment https://forums.phpfreaks.com/topic/35371-not-saving-record-in-the-database/#findComment-167192 Share on other sites More sharing options...
franknu Posted January 23, 2007 Author Share Posted January 23, 2007 I changed $uploaddir to UPLOADDIR and still i keep getting the same message on the same line[code=php:0] if (move_uploaded_file($_FILES['Picture2']['tmp_name']. UPLOADDIR .$fullpath1) && ($_FILES['Picture1']['tmp_name']. UPLOADDIR .$fullpath2))[/code] Quote Link to comment https://forums.phpfreaks.com/topic/35371-not-saving-record-in-the-database/#findComment-167203 Share on other sites More sharing options...
franknu Posted January 23, 2007 Author Share Posted January 23, 2007 please help Quote Link to comment https://forums.phpfreaks.com/topic/35371-not-saving-record-in-the-database/#findComment-167504 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.