Guest User

Untitled

a guest
Apr 30th, 2012
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. PHP force download of remote file without reading into memory
  2. if($url = getRemoteFileURL($file_id))
  3. {
  4. header('Content-Type: application/octet-stream');
  5. header('Content-Disposition: attachment; filename="abc.zip"');
  6. header('Content-Transfer-Encoding: binary');
  7. header('Expires: 0');
  8. header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  9. header('Pragma: public');
  10. header('Pragma: no-cache');
  11.  
  12. readfile($url); // is there a better function ?
  13. }
Advertisement
Add Comment
Please, Sign In to add comment