saving multiple files path in the database

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Locked
franknu
Forum Contributor
Posts: 146
Joined: Sun May 28, 2006 9:29 am

saving multiple files path in the database

Post by franknu »

ok, i have a code that uploads multiple files it works if i use is_uploaded_file() but it send the files to diffrent rows which means i will have diffrent ID. when i use move_uploaded_file() which is the one i need then i doest upload anything iit says it did but when i look in the database there is nothing there


PLEASE HELP

Code: Select all

$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;

 $filename1=$_POST['name']. "1";
 $result= move_uploaded_file($_FILES['Picture1']['tmp_name'],  $fullpath1. "$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'], $fullpath. "$filename2");

  if ($result==1)

  {

  echo"Picture2 uploaded";

}

  If (is_uploaded_file ($_FILES['Picture1']['tmp_name']) && 
     ($_FILES['Picture2']['tmp_name'])) 

{

  $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')";
       
}

}


?>
User avatar
s.dot
Tranquility In Moderation
Posts: 5001
Joined: Sun Feb 06, 2005 7:18 pm
Location: Indiana

Post by s.dot »

you need to perform a mysql_query() on the $sql.

What is uploaded, and what shows up in the database, is two entirely different operations.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
franknu
Forum Contributor
Posts: 146
Joined: Sun May 28, 2006 9:29 am

Post by franknu »

it seems that my biggest problems is the upload. i need some
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

This is the exact same situation as your last thread. No need for another thread on it.

Locked.
Locked