Re: file downloads

From: Date: Sat, 04 Aug 2001 17:27:25 +0000
Subject: Re: file downloads
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-61253@lists.php.net to get a copy of this message
I usually put or die(mysql_error()) and make it work before I put in the @, that's been done already. This will display the image $result = @mysql_query($query); $row = mysql_fetch_row($result); $path = $row[0]; print "<img src=\"$path\">"; What I want is to display a 'save as' box to download the image whose file path is stored in the variable $path. Am I doing something wrong in the header section? The print statement would be commented out if I used this. $file_path = basename($path); header("Content-Type: application/download\n"); header("Content-Disposition: attachment; filename=$file_name"); header("Content-Transfer-Encoding: binary"); readfile($path); Data Driven Design 1506 Tuscaloosa Ave Holly Hill, Florida 32117 http://www.datadrivendesign.com Phone: (386) 226-8979 Websites That WORK For You ----- Original Message ----- From: "Rasmus Lerdorf" <rasmus@php.net> To: "Data Driven Design" <jeff@datadrivendesign.com> Cc: <php-general@lists.php.net> Sent: Saturday, August 04, 2001 1:01 PM Subject: Re: [PHP] file downloads > > I made the changes you suggested and it's still a no go. I'm sure of the > > query because > > > > print "<img src=\"$path\">"; > > > > Will display the image I'm trying to download. > > How does that make the SQL query valid? You didn't implement the > mysql_query() error checking I suggested. That's likely what is causing > you problems. > > -Rasmus > >

« previous php.general (#61253) next »