Hi,
Is it possible to user to move_uploaded_file
to upload files to a server and insert the file name into MySQL to act as a image source.
I have file upload working but need now to
get this to populate my MySQL DB with these files names so I can automatically create image links.
<?php
$db = mysql_connect("localhost", "user", "passwd")
or die ("cant connect to the DB");
// define the base image dir
$base_img_dir = "/var/www/html/test/images/";
// generate unique id for use in filename
$uniq = uniqid("");
// new file name
$filename = $base_img_dir.$uniq;
//I know the following is wrong but you get the //idea.
//$filename = $image_MySQL_database_id.jpg;
// move uploaded file to destination
move_uploaded_file($HTTP_POST_FILES["file"]["tmp_name"], $filename);
?>
Any ideas folks?
G