DraKiNs

[COD] ForceDownloadFile

Jun 26th, 2011
238
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.34 KB | None | 0 0
  1. function ForceDownloadFile($arquivo)
  2. {
  3.    if(!file_exists($arquivo)) return false;
  4.     $tipo = strstr($arquivo,'.');
  5.    header("Content-Type: ".$tipo);
  6.    header("Content-Length: ".filesize($arquivo));
  7.    header("Content-Disposition: attachment; filename=".basename($arquivo));
  8.    readfile($arquivo);
  9. }
  10. //force download file by garfield
Add Comment
Please, Sign In to add comment