You are here: Re: Link, which always offers to save/open.... « HTML « IT news, forums, messages
Re: Link, which always offers to save/open....

Posted by John Hosking on 03/28/07 09:30

jodleren wrote:
> On Mar 13, 9:04 pm, Toby A Inkster <usenet200...@tobyinkster.co.uk>
> wrote:
>
>>jodleren wrote:
>>
>>>Toby A Inkster <usenet200...@tobyinkster.co.uk> wrote:
>>
>>>>Google: HTTP Content-Disposition header
>>

> Would there be a problem with getting the extension of the file and
> using it, such as:
> $ext = get_extension_of_file;
>
> header("Content-type: application/$ext");

The MIME type doesn't always (or even usually) match the file extension.

>>Using made-up content types like the one you've used above may seem to be
>>"convenient", but it harms the web as a whole.
>
> What do you think about this?
> header("Content-Disposition: attachment; filename=\"$file\"");

You'd also need to set the content-type to something nasty[1]. Please
don't.

> Is there a place where headers are listed?

Google is your friend. Well, it's *our* friend, but you could use it too.

Take a look at http://www.w3schools.com/media/media_mimeref.asp. I
cannot vouch for the veracity of the content in that table, since
www.w3schools.com isn't always accurate, but it will give you an idea of
what you're dealing with. Note especially the links at the top of the
page, leading you to the RFC (Request For Comment) documents which are
the source of this information.

[1]http://www.onjava.com/pub/a/onjava/excerpt/jebp_3/index3.html

--
john

 

Navigation:

[Reply to this 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

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