
Untitled
By: a guest on
Apr 30th, 2012 | syntax:
None | size: 0.47 KB | hits: 11 | expires: Never
PHP force download of remote file without reading into memory
if($url = getRemoteFileURL($file_id))
{
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="abc.zip"');
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Pragma: no-cache');
readfile($url); // is there a better function ?
}