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" <[EMAIL PROTECTED]>
To: "Data Driven Design" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, August 04, 2001 11:57 AM
Subject: Re: [PHP] file downloads


> > Why does this code produce a page cannot be displayed error?
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to