Hi
Sorry, new to this. I understand when using a form to upload image files and information into a mysql database it is best practice to store the image in a directory and the image path in the mysql table. The following code stores the image into a directory and the image name the table using the basename function:-
<?PHP
$target = "images/";
= $target . basename( $_FILES['image']['name']);
$name=$_POST['name'];
$pic=($_FILES['image']['name']);
mysql_connect("localhost", "NAME", "PWORD") or die(mysql_error()) ;
mysql_select_db("TABLENAME") or die(mysql_error()) ;
mysql_query("INSERT INTO 'TABLENAME' VALUES ('name' 'image'");
if(move_uploaded_file($_FILES['image']['tmp_name'], $target))
?
>
string basename ( string $path [, string $suffix ] )
?>
To store the path e.g images/image.jpeg iin the databse do I use the pathinfo() function instead of the basename function?
thanks mark