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" <[EMAIL PROTECTED]>
To: "Data Driven Design" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
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
>
>


-- 
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