Article View: chile.comp.programacion
Article #2314Re: Manito para bajar archivos...
From: Pintamono
Date: Mon, 23 Jan 2006 19:17
Date: Mon, 23 Jan 2006 19:17
26 lines
2293 bytes
2293 bytes
Hecho.
header("Content-Disposition: attachment; filename={$new_name}");
$new_name correponde al nombre de archivo que se le ofrece al usuario,
ademΓ‘s faltaba colocar la funcion readfile() que es la encargada de
leer el archivo que se quiere descargar.
Dejo el codigo por si alguiie lo quiere:
<?
if (is_file("../".$_GET[arch]))
{
$archivo="../".$_GET[arch];
list($directorio, $arch) = explode ("/", $_GET['arch']);
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Content-type: application/x-download");
header("Content-Disposition: attachment; filename=\"".$arch."\";");
//Indica el nombre de archivo que tendra al bajar
header("Content-Transfer-Encoding: binary");
@readfile($archivo) or die("No se pudo encontrar el archivo"); // Lee
el archivo que se quiera bajar
}
else
header('Location: '.$_GET[arch]); // Si no es archivo, debe ser un
enlace (para mi sistema si) por lo tanto redirecciona hacia alla.
?>
Technical Details
Message-ID:
<1138043875.231653.175170@f14g2000cwb.googlegroups.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mailReferences:
<1137609255.496161.287330@g43g2000cwa.googlegroups.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 1593cb,3a9f8a7f6cecd175 X-Google-Attributes: gid1593cb,public X-Google-Language: SPANISH,ASCII Path: arc1-ca.pugleaf.net!g2news1.google.com!postnews.google.com!f14g2000cwb.googlegroups.com!not-for-mail From: "Pintamono" <pintamono79@yahoo.es> Newsgroups: chile.comp.programacion Subject: Re: Manito para bajar archivos... Date: 23 Jan 2006 11:17:55 -0800 Organization: http://groups.google.com Lines: 27 Message-ID: <1138043875.231653.175170@f14g2000cwb.googlegroups.com> References: <1137609255.496161.287330@g43g2000cwa.googlegroups.com> NNTP-Posting-Host: 200.112.41.246 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1138043880 9853 127.0.0.1 (23 Jan 2006 19:18:00 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 23 Jan 2006 19:18:00 +0000 (UTC) In-Reply-To: <1137609255.496161.287330@g43g2000cwa.googlegroups.com> User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.0; es-AR; rv:1.8) Gecko/20051111 Firefox/1.5,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: f14g2000cwb.googlegroups.com; posting-host=200.112.41.246; posting-account=skJ50Q0AAACOrmQ9kj5c1tjv36P849np