Re: file downloads

From: Date: Sat, 04 Aug 2001 17:00:53 +0000
Subject: Re: file downloads
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-61248@lists.php.net to get a copy of this message
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. This is my environment. PHP Version 3.0.16 Apache/1.3.3 Cobalt safe_mode 1 <?php mysql_connect("localhost","user","pass"); mysql_select_db("db"); $query = "SELECT file_path from photos where photos_id=$photos_id"; $result = @mysql_query($query); $row = mysql_fetch_row($result); $path = $row[0]; $file_name = basename($path); //print "<img src=\"$path\">"; //print "<div align=\"center\">$file_name</div>"; header("Content-Type: application/download\n"); header("Content-Disposition: attachment; filename=$file_name"); header("Content-Transfer-Encoding: binary"); readfile($path); ?> This should work shouldn't it? ----- 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 11:57 AM Subject: Re: [PHP] file downloads > > Why does this code produce a page cannot be displayed error? >

« previous php.general (#61248) next »