If you get a damaged file error, try this:
header('Pragma: public'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Cache-Control: private', false); header('Content-Type: application/pdf'); header('Content-disposition: attachment; filename=' . basename($file)); header("Content-Transfer-Encoding: binary"); header('Content-Length: ' . filesize($file)); // provide file size header('Connection: close'); readfile($file);
Where $file is the full path or URL of the file.
poxtron
source share