Re: Download de archivos
| From: | LOGin - Desarrollos | Date: | Wed, 30 Jun 2004 20:57:46 +0000 |
| Subject: | Re: Download de archivos | ||
| References: | 1 | Groups: | php.general.es |
| Request: | Send a blank email to general-es+get-49728@lists.php.net to get a copy of this message | ||
hola
proba poniendo el content-type del archivo que se tiene que bajar (por
ejemplo si es un pdf poner Header('Content-Type: application/pdf');)
y despues este otro header siguiendo con el ejemplo de un pdf
Header('Content-disposition: attachment; filename='archivo.pdf');
y despues le haces la salida al navegador del contenido
por ahi te funciona
saludos
----- Original Message -----
From: <marolijo@yahoo.es>
To: "PHP-ES" <php-es@lists.php.net>
Sent: Wednesday, June 30, 2004 2:59 PM
Subject: [PHP-ES] Download de archivos
> Hola, utilizo esta funcion para descargar archivos, pero con Explorer no
> reconoce el nombre fichero. Me imagino que des de PHP no le estoy pasando
> bien alguna cabecera... No se si lo veréis como un OT, pero creo que tiene
> que ver con PHP. Si alguien lo ve así, pido perdón...
>
> Muchas gracias.
> Marolijo
>
> <?php
> $file = "docs/";
> $file .= $_GET['fitxer'];
> //$file = "docs/mapa-bcn.pdf"; // file to be send to the client
> $speed = 22.0; // 8,5 kb/s download rate limit
> if(file_exists($file) && is_file($file)) {
> header("Cache-control: private");
> header("Content-Type: application/octet-stream");
> header("Content-Length: ".filesize($file));
> // header("Content-Disposition: filename=$file" . "%20");
> header("Content-Disposition: filename=$file");
> flush();
> $fd = fopen($file, "r");
> while(!feof($fd)) {
> echo fread($fd, round($speed*1024));
> flush();
> sleep(1);
> }
> fclose ($fd);
> ?>
>
> __________________________________________________
>
> PolNetwork.com
> Pol Maresma i Oliveras
> pol@polnetwork.com - webmaster@santpol.org
> Creació, manteniment i allotjament de pàgines Web
> __________________________________________________
>
> PRIVAT I CONFIDENCIAL - Aquest missatge i els document adjunts que pugui
> contenir són confidencials. Si no sou el destinatari del missatge no teniu
> permís per llegir-lo, copiar-lo ni reenviar-lo. Si heu rebut aquest
missatge
> per error, siusplau comuniqueu-ho al remitent retornant el missatge i
> esborreu les còpies del missatge i els seus documents adjunts. Aquest avís
> no pot ser eliminat.
>
> PRIVATE & CONFIDENTIAL - This email message and attachments contain
> information that is confidential. If you are not the intended recipient,
you
> are not permitted to use, copy or distribute the message and attachments
in
> any manner. If you have received this email in error, please inform the
> sender by return email immediately and delete all copies of the message
and
> its attachments. This notice should not be removed.
> __________________________________________________
>
>
>
>
>
----------------------------------------------------------------------------
----
> --
> PHP Spanish Localization Talk Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php