Manipulating headers: Downloads

  1. Redirects
  2. Manipulating headers
  3. Host

We’ve already looked at one header manipulation: the downloads class sends headers that cause the browser to download the file instead of display it.

header('Content-Type: audio/mpeg');

header('Content-Disposition: attachment; filename="Complicated Man.mp3"');

What is a content type?

The Internet uses MIME types to identify a type of file, so that the visitor’s operating system can know what applications are able to open it. You can see more about MIME types at:

http://www.w3schools.com/media/media_mimeref.asp

http://en.wikipedia.org/wiki/Internet_media_type

MIME types are used by e-mail (just as most headers are) as well as web servers.

  1. Redirects
  2. Manipulating headers
  3. Host