Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 ?
- }
Advertisement
Add Comment
Please, Sign In to add comment