Re: download txt
| From: | Alex Verstraeten | Date: | Wed, 04 Oct 2000 18:44:12 +0000 |
| Subject: | Re: download txt | ||
| References: | 1 2 3 4 5 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-2180@lists.php.net to get a copy of this message | ||
> alguien conoce alguna forma de hacer un link a un .txt por decirlo asi y
que
> me de la opcion de hacer el download SIEMPRE en luugar de cargarmelo en el
> navegador como una pagina mas?
suponiendo que tenes un archivo de text llamado "archivo.txt" , pone en el
mismo dir un archivo php que sea algo asi como:
<?
$file = "archivo.txt";
header("Content-Type: plain/text");
header("Content-Disposition: attachment; filename=$file");
readfile($file);
?>
para mas informacion sobre estos headers leer el RFC 2183 en:
http://www.rfc-editor.org/rfc/rfc2183.txt
saludos,
Alex