pdf download problems
Posted: Tue Oct 05, 2010 1:54 pm
All, Im using the following to download pdf blobs from mysql:
This works on my local desktop retrieving the blob pdf from a remote db. I moved this code to cascade server, on another machine. the pdf is getting posted to the page, not a download box like on my local machine. basically, I see bytes and garbled characters. At first, there was no pdflib extension, so I installed it. Still no good.
Any ideas?
Code: Select all
$download = "select data, mimeType, filename from minutes where minutesId='".$id."' and length(trim(filename))>0 and data is not null";
$downloadResult = @mysql_query($download);
if($row = @mysql_fetch_array($downloadResult)){
$data = @mysql_result($downloadResult, 0, "data");
$mimeType = @mysql_result($downloadResult, 0, "mimeType");
$fileName = $_GET['filename'];
header("Content-type: $mimeType");
header("Content-Disposition: attachment; filename=$fileName");
header("Content-type: application/force-download");
echo $data;
exit;
Any ideas?