Hi Guru.
I really need yr help.
Im trying to do upload and download any document in my code.
The upload no problem at all.It can upload any files eg text, MSWord, jpeg, pdf files and store it on mysql db structure using mediumblom data type.
The problem is when I'm trying to download MSWORD document. The problem same when I'm save as or open directly using MSWORD application. The MSword document contain binary (rubbish char). There is no problem when open text file or pdf or jpeg file..
Here I attach the download coding for yr reference :
$id = $_GET['id'];
$query2 = "SELECT `name`, `type`, `size`, `content`, `path` FROM op_main_man WHERE plan_nm ='$id'";
$result2 = mysql_query($query2) or die('Error, query failed');
list($name, $type, $size, $content, $filePath) = mysql_fetch_array($result2);
readfile($filePath);
header("Content-Description: Open Document");
header("Content-Disposition: attachment; filename=$name");
header("Pragma: no-cache");
header("Content-length: $size");
header("Content-type: $type");
header("Expires: 0");
echo $content;
Please help me guru..
Thanks..