开发者

How To Make Zip Blob Files Ready for Download From MySQL Database

I have created a database with a table that contains blob wherein I saved ZIP and PDF files. The problem is, how can I make these files ready for download through P开发者_高级运维HP scripts?


Like this:

$name = "file.zip"; // or file.pdf
$file_content = $blob_row['file_content'];

header('Content-Description: File Transfer');

header('Content-Type: archive/zip'); // or archive/pdf

header('Content-Disposition: attachment; filename=' . $name);

header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . strlen($file_content));
ob_clean();
flush();

echo $file_content;
exit;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜