Ver Mensaje Individual
  #22 (permalink)  
Antiguo 28/03/2007, 08:28
rubioruizjorge@yahoo
 
Fecha de Ingreso: marzo-2007
Mensajes: 1
Antigüedad: 17 años, 10 meses
Puntos: 0
Re: Descargar Archivo

Haber como les va con algo como esto:

el archivo que tengo es un txt, pero como es muy grande lo comprimo con gzip y luego si lo descargo, espero les sirva.

/////////////

$file="/srv/www/htdocs/mi_aplicacion/files/datos.txt";
@unlink($file);

$sql="select * from tabla into outfile '$file';";
mysql_query($sql);

system('gzip -9 '.$file);

$filename = "datos.txt.gz";
$size = filesize($file);

header("Pragma: no-cache");
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");
header("Content-Transfer-Encoding: base32");
header("Content-type: application/force-download");
header("Content-type: application/x-gzip");
header("Content-Disposition: attachment; filename=$filename");
header("Content-Length: $size");

@readfile("$file");
exit();
////////////