I have to add several values to a table and one of them is an image, Well i get the ID from the table entry then make a directory called that ID and then move the file into that directory. Here is the script hopefully someone can help
<?php
require ('dbconnect.php');
$name = addslashes($name);
$members = addslashes($members);
$biography = addslashes($biography);
$myspace = addslashes($myspace);
$bandurl = addslashes($bandurl);
mysql_query("INSERT INTO bands
(name, members, image, bandurl, biography, myspace) VALUES ('$name', '$members', 'NULL', '$bandurl', '$biography', '$myspace') ")
or die(mysql_error()); {
$foldername = mysql_insert_id();
$targetpath = mkdir("$foldername", 0777);
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$name = stripslashes($name);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo '<font face="Tahoma" size="2">Your band entry <b>'.$name.'</b> has been posted.</font>';
} else{
echo "There was an error.";
}
}
?>