displaying binary data to browser and set mime type

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • GS

    displaying binary data to browser and set mime type

    Hello-

    Im new to PHP. I am looking for a link or help on how to set the
    mime type in my php script as well as send binary data to the browser
    window instead of having it ask me to save the file.

    Any pointers/help is appreciated.
    Jeff

  • Sjoerd

    #2
    Re: displaying binary data to browser and set mime type

    header("Content-type: image/png");

    Comment

    • Alvaro G. Vicario

      #3
      Re: displaying binary data to browser and set mime type

      *** GS escribió/wrote (8 Dec 2005 09:03:00 -0800):[color=blue]
      > Im new to PHP. I am looking for a link or help on how to set the
      > mime type in my php script as well as send binary data to the browser
      > window instead of having it ask me to save the file.[/color]

      Setting MIME type is easy:

      header('Content-Type: foo/bar');

      You can also tell the browser to display data inline:

      header('Content-Disposition: inline; filename="foo"' );

      That's the server-side work. Now you need that the browser follows the
      directions provided by the server, and that's going to be your main
      difficulty. Internet Explorer is well known for ignoring these directions
      so you'll need a lot of tweaking. Firefox though tends to obey them.


      --
      -+ Álvaro G. Vicario - Burgos, Spain
      ++ http://bits.demogracia.com es mi sitio para programadores web
      +- http://www.demogracia.com es mi web de humor libre de cloro
      --

      Comment

      Working...