Hello forums !!
I used the following code to upload the image in the DB
$tmp_name = $_FILES['file']['tmp_name'];
$filesize = filesize($tmp_name);
$filename = $_FILES['file']['name'];
$file_type = $_FILES['file']['type'];
$contents = fread(fopen($tmp_name,'rb'),$filesize);
//fclose($tmp_name);
//echo $contents;
//$contents = base64_encode($contents);
$addFile = "INSERT INTO mantis_bug_file_table
(bug_id,filename,filesize,file_type,date_added,content)
VALUES
('$idbug','$filename','$filesize','$file_type',NOW(),'$contents')";
//echo $add5;
$resultFile = mysql_query($addFile) or die(mysql_error());
when i run this code , apache got down and nothing worked.
when i removed the $contents from the query or encoded the $contents with base64_encode() then it went right.
What's the problem with reading the upload image and inserting it in the database or this is not the way of inserting image into database ?
Any Idea ? Please Help
Thanks in advance to all of you !