I have a problem downloading the Blob file from MYSQL using php.
Here is my php script in downloading file:
$querysel = "Select * from file where file_id = '$fileid'";
$resultsel = mysql_query($querysel);
$rowsel = mysql_fetch_array($resultsel);
$filename = $rowsel['file_name'];
$mimetype = $rowsel['mime_type'];
$filesize = $rowsel['file_size'];
header("Content-length: ".$filesize);
header("Content-type: ".$mimetype);
header("Content-disposition: attachment; filename=".$filename);
header("Content-Description: PHP Generated Data");
header("Content-transfer-encoding: binary");
echo $filename;
PROBLEM [UPDATED]
What seems to be the problem here is that after downloading the file, the file size from that particular file don't match with the file size saved in mysql. I don't know why?
I also encounter this small problem, After I downloaded the Powerpoint and delete it and download it again would be automatically saved to downloads and will automatically be opened. Is that normal?
Example:
The BLOB file with 6.8MB of file size was supposed to be downloaded with 6.8MB also but what happened here is that the file size of the downloaded file is only 25bytes. Why?
Any help would be much appreciated. Thanks