0); } // faz o download de um arquivo usando um protocolo compatível com o I.E. e com // o firefox. Falta testar no Opera e no Chrome function downloadfile($file) { if (isset($file)) { $filesize = remote_filesize($file); header('Content-Description: File Transfer'); header('Content-Type: application/octet-stream'); header('Content-Disposition: attachment; filename='.basename($file)); header('Content-Transfer-Encoding: binary'); header('Expires: 0'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public'); if ($filesize) header('Content-Length: ' . $filesize); ob_clean(); flush(); @readfile($file); } } // retorna uma string com o tamanho codificado em bytes, kb, mb, gb, ... function size_str($size) { $info = array("b","KB","MB","GB","TB", "PB"); for ($i=0; $size > 1023; $i++) $size /= 1024; if ($size > 0) return round($size, 1). $info[$i]; return "Desconhecido"; } ?>