Reply to Re: [PHP] Re: A general question

Your name:

Reply:


Posted by Richard Lynch on 03/08/05 18:56

> $len = filesize($file_path);
> header("Content-Type: application/force-download");
> header("Content-Type: application/octet-stream");

Call me crazy, but sending TWO Content-type: headers seems just plain
WRONG to me.

application/octet-stream will force a download in EVERY http-compliant
browser.

> header("Content-Disposition: attachment; filename=$file");
> header("Content-Title: $file_path");
> header("Content-Length: $len");
> readfile($file_path);
>
> $fh=fopen($file_path,'rt');
> @fclose($fh);
>
> HTH
>
> <?php
> /*
>
> Stephen Johnson c | eh
> The Lone Coder
>
> http://www.thelonecoder.com
> stephen@thelonecoder.com
>
> 562.924.4454 (office)
> 562.924.4075 (fax)
>
> continuing the struggle against bad code
>
> */
> ?>
>
>> From: zzapper <david@tvis.co.uk>
>> Date: Mon, 07 Mar 2005 17:19:30 +0000
>> To: php-general@lists.php.net
>> Subject: [PHP] Re: A general question
>>
>>
>>> How can I click on a link which is linked to a JPG file and instead of
>>> displaying it in the browser save it somewhere on the local machine or
>>> open in a different software ?
>>>
>>> Please help very urgent
>>>
>>> Thanks
>>> vaibhav
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Like Music?
http://l-i-e.com/artists.htm

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация