Wednesday, July 3, 2013

how to download large pdf file using php header function ?SOLVE ISSUE

<?php
if($filepath!=''){
header('Pragma: public');  // required
header('Expires: 0');  // no cache
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Cache-Control: private', false);
header('Content-Type: application/pdf');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', filemtime($filepath)) . ' GMT');
header('Content-Disposition: attachment; filename=' . urlencode(basename($filepath)));
header("Content-Transfer-Encoding:  binary");
header('Content-Length: ' . filesize($filepath)); // provide file size
header('Connection: close');
ob_end_clean();
readfile($filepath);
exit();
}

No comments:

Post a Comment