Does anyone see anything wrong with this code, I know there is something because It does not work. It is suppose to create a folder, rename pictures to picture1.jpg, picture2.jpg, etc.,put pictures inside that particular folder on file directory, and save a file path into database? Any ideas?
<?php
if(isset( $Submit ))
$ID=$_POST[ID];
mkdir("/var/www/html/Bella/upload/files/$ID", 0777);
//If the Submitbutton was pressed do:
$path="/var/www/html/Bella/upload/files/$ID/";
$i=1;
foreach($_FILES as $file=>$array) {
move_uploaded_file($_FILES[$file]['tmp_name'],$path."picture".$i.".jpg");
$i++;
}
/* Connecting, selecting database */
$link = mysql_connect("localhost", "user", "pass")
or die("Could not connect : " . mysql_error());
echo "<P>Connected successfully<BR>";
$dbname="database";
mysql_select_db($dbname) or die("Could not select database");
/* add the new information into the database*/
$query="UPDATE client_info SET path='$path' where ID =$ID";
if(!mysql_db_query($dbname,$query,$link)) die(mysql_error());
echo "<br>Good! Information has been succesfuly entered.";
echo "<br>";
echo "<a href=\"upload.php\">Click here to return to the form page.</a>";
?>