Re: Content Header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* "Christopher J. Umina" <uminac@xxxxxxxxxxxxxx>:
> Hello!
>
> I currently have a script which streams data out of a MySQL database, 
> and prints the content headers correctly, however, when I use the 
> following line:
>
> header("Content-Disposition: attachment; filename=\"". $filename ."\"");
>
> it prompts the user to download the file each time they go to the site. 
>   The problem is, I want the filename to be in the header, incase 
> somebody right clicks and saves the file, but I don't want the user to 
> be prompted to download the file when they're just trying to look at 
> it.  Does anybody know a way I can achieve this result?

As long as the "Content-Disposition: attachment" header is present, the
browser will believe a file is being sent.

One solution is to have two different links, with an optional download
flag in the query string. Then, in your script, generate the
Content-Disposition header for 'download' requests, don't otherwise.

-- 
Matthew Weier O'Phinney
Zend Certified Engineer
http://weierophinney.net/matthew/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux