PDA

View Full Version : Upload Image into database



devil_vin
10-27-2007, 08:51 AM
Hey,guys! I have a form to upload image into database,which had a BLOB type column called banner to store the image.How can I specific it in INSERT statement?Thanks...



<form name="addMovie" method="post" action="<? echo htmlentities($HTTP_SERVER_VARS['PHP_SELF']); ?>"
enctype="multipart/form-data">
<input type="file" name="banner" value="banner">
</form>


Validation for the file format is done.



if ($_FILES['banner']['type'] != "image/gif" || $_FILES['banner']['type'] != "image/jpeg")
{
$javascript = 'alert(\'Please upload image file with gif or jpeg format
only!\');';
}

djr33
10-27-2007, 09:01 AM
Insert a url/file path to the database and info if you want; store the photo in a directory, and you're done. Easier and less work for the database. Storing it in full will make the db bulky and slower.