
andrewsec
(usa Ubuntu)
Enviado em 13/01/2014 - 23:57h
Salve galera.
Estou com um código PHP para forçar download de arquivos, só que o problema é que ele só esta fazendo o download de arquivos até 200 mb MAIS OU MENOS, acima disso ele não baixa ou vem corrompido.
Alguém tem uma solução?
<?php
$arquivo1 = mysql_real_escape_string($_GET["file"]);
$arquivo = "arquivos/" . basename($_GET["file"]);
if(isset($arquivo) && file_exists($arquivo)){
switch(strtolower(substr(strrchr(basename($arquivo),"."),1))){
case "pdf": $tipo="application/pdf"; break;
case "exe": $tipo="application/octet-stream"; break;
case "zip": $tipo="application/zip"; break;
case "doc": $tipo="application/msword"; break;
case "xls": $tipo="application/vnd.ms-excel"; break;
case "ppt": $tipo="application/vnd.ms-powerpoint"; break;
case "gif": $tipo="image/gif"; break;
case "png": $tipo="image/png"; break;
case "jpg": $tipo="image/jpg"; break;
case "mp3": $tipo="audio/mpeg"; break;
case "php": // deixar vazio por seurança
case "htm": // deixar vazio por seurança
case "html": // deixar vazio por seurança
}
header("Cache-Control: public");
header("Content-Description: File Transfer");
header('Content-Disposition: attachment; filename="'.$arquivo1.'"');
header("Content-Type: mime/type");
header("Content-Transfer-Encoding: binary");
fopen($arquivo);
exit;
}else{
echo "ERRO";
return false;
}
?>
Aguardo ajuda!
VALEU!