Re: content type header for downloading files

From: Date: Thu, 30 Jan 2003 18:02:36 +0000
Subject: Re: content type header for downloading files
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-133677@lists.php.net to get a copy of this message
Hi, I would like to test you code in my webpage, but i dont really know how to get along with path informations like ../images/pictures/image24.jpg Do I have to split the string in multiple parts, so i at last only got the picture name? But how then do i open the file? - thru fopen() or something equal or how do you do it? Please gimme some more informations if you like :)) Greetings Sascha ----- Original Message ----- From: "Ernest E Vogelsinger" <ernest@vogelsinger.at> To: "Dara Dowd" <daradowd@campus.ie> Cc: <shiflett@php.net>; <php-general@lists.php.net> Sent: Thursday, January 30, 2003 10:27 AM Subject: Re: [PHP] content type header for downloading files > At 02:04 30.01.2003, Dara Dowd said: > --------------------[snip]-------------------- > >$fname is the name of the file i want to download. It works in IE, as in the > >name of the file to be downloaded appears correctly in the dialog box. I > >changed 'application/octet' to 'application/octet-stream' and this had > >no > >effect. > --------------------[snip]-------------------- > > This is what I do to transmit a file for a save-as download, and it works > in all browsers I know and have tested the same (Netscape, IE, Opera/Win; > Mozilla, Konqueror et al. / Linux): > > header('Content-type: application/octet-stream'); > header('Content-length: ' . strlen($this->export)); > header('Content-Disposition: attachment' . > (empty($fname) ? '' : > ';filename="'.$fname.'.csv"')); > echo $this->export; > exit(); > > Note that it seems to be necessary to surround the filename using quotes to > make it work correctly. > > > > -- > >O Ernest E. Vogelsinger > (\) ICQ #13394035 > ^ http://www.vogelsinger.at/ > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.general (#133677) next »