i am store image in database by using long blob.
here is my code for that
$file = isset($_FILES['fileupload']) ? $_FILES['fileupload']['tmp_name'] : false;
...
$query = mysql_query("Select * FROM image WHERE image_short_name = '$image_short_name_p' AND user_id='$id'");
$image = chunk_split(base64_encode(file_get_contents($_FILES['fileupload']['tmp_name'])));
$image_width_height = getimagesize($_FILES['fileupload']['tmp_name']);
$insert = mysql_query("INSERT INTO image VALUES(NULL, '$user_id_db', '$image',
'$image_full_name', '$image_short_name_p', '$image_des_p','' ,'$image_resolution',0, 0)"
it works fine but if i upload a really big image it get me error for ex.
Warning: mysql_query() [function.mysql-query]: MySQL server has gone away in C:\xampp\htdocs\a_upload\upload.php on line 59
Warning: mysql_query() [function.mysql-query]: Error reading result set's header in C:\xampp\htdocs\a_upload\upload.php on line 59
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\a_upload\upload.php on line 103
not sure how can i fix this problem.
i was think some thingk like this but i dont know how to do this
if(image size is bigger than long blob)
{
reduce size so it fits
}
note i want to store in database and yes i know i should do it like that.