Hi all
I have the following script 99.9% working for uploading a single image to a database -
Storing the file in a folder and placing a link to the file in the database -
The only problem im having now is when the image is uploaded the extension of the image is removed
the file is stored as imagename. (but I need to store the image correctly)
Is there anyone here that can help me with this please.
here is the code im using
$qry = "INSERT INTO mgallery(id,uid,mpicture,title,date) VALUES('','$id','$image_name','$title',now())";
$result = @mysql_query($qry);
$image_ext = explode('.', $image); //split the image name with respect of " . "
$image_name = date('Ymdhis'). "." . $image_ext[1]; //create unique image name with present "date & time"
$dest = "uploaded/$id";
$dest = $dest."/".$image_name;
move_uploaded_file($_FILES['profile_image']['tmp_name'], $dest); //upload image to the destination path
//if($result){
mysql_query("update mgallery set mpicture ='http://www.website.com/members/$dest'"); //WORKING IMAGE UPLOAD
echo "Success";
exit ();
}
else
{
die("Upload failed");
}
}
?>