Re: Descargar siempre un archivo almacenado en la base de datos.

From: Date: Sat, 03 May 2008 16:48:57 +0000
Subject: Re: Descargar siempre un archivo almacenado en la base de datos.
References: 1 2 3 4  Groups: php.general.es 
Request: Send a blank email to general-es+get-62578@lists.php.net to get a copy of this message
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > -------------------------------------------------------------------------------------------- > > $sel= "select archivo from archivo limit 1"; > $q= pg_query($sel) or die("fallo"); > > $r= pg_fetch_array($q); > > header('Content-type: application/force-download'); > header('Content-type: application/octet-stream'); > header('Content-type: application/download'); > header('Content-Disposition: attachment; > filename='.pg_unescape_bytea($r["archivo"]).''); > > Bueno antes que nada me imagino que pablo se referia que tu lo comprimieras > en zip y no el usuario. > > pero el detalle que yo veo aqui es el siguiente > > $sel= "select archivo from archivo limit 1"; > $q= pg_query($sel) or die("fallo"); > > $r= pg_fetch_array($q); > filename='.pg_unescape_bytea($r["archivo"]).''); > > $r["archivo"] = al valor osea el archivo y no al nombre con el que se > descargara el archivo > > entonces seria asi: > > $sel= "select archivo from archivo limit 1"; > $q= pg_query($sel) or die("fallo"); > > $r= pg_fetch_array($q); > > header('Content-type: application/force-download'); > header('Content-type: application/octet-stream'); > header('Content-type: application/download'); > header('Content-Disposition: attachment; filename='nombre_archivo.ext' "); > > echo pg_unescape_bytea($r["archivo"]; > > > y asi si se deescargaria, suerte! Estupendo. Muchas gracias. - -- < ¡¡Nos vemos!! > ---------------------------- \ \ .::!!!!!!!:. .!!!!!:. .:!!!!!!!!!!!! ~~~~!!!!!!. .:!!!!!!!!!UWWW$$$ :$$NWX!!: .:!!!!!!XUWW$$$$$$$$$P $$$$$##WX!: .<!!!!UW$$$$" $$$$$$$$# $$$$$ $$$UX :!!UW$$$$$$$$$ 4$$$$$* ^$$$B $$$$\ $$$$$$$$$$$$ d$$R" "*$bd$$$$ '*$$$$$$$$$$$o+#" """" """"""" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFIHJd5K7lGsMchFswRApe9AJ438Ar6uKxJGR/hgqJeTUzQimRZvgCgoEtP RR1v7862Rme0zcGxDW/agn8= =YGBf -----END PGP SIGNATURE-----

« previous php.general.es (#62578) next »