tester: php als csv/doc/o.ä.

moin

hab ne php datei, die nen inhalt im format einer doc oder csv datei hat.
nun will ich nicht ne <pre> anweisung drumrum machen, sondern die datei als doc im browser anzeigen lassen.
hab mal das versucht:
header("Content-Type: text/doc");
und das
header("Content-Type: text/txt");

scheint aber noch irgendwas zu fehlen...

wie muss ich das machen, dass es geht?

danke

  1. Hallo,

    header("Content-Type: text/doc");

    Das ist kein offizieller MIME-Typ.

    application/msword
    waere korrekt gemaess
    http://selfhtml.teamone.de/diverses/mimetypen.htm
    http://phd.pp.ru/Software/dotfiles/mime.types.html
    http://www.w3schools.com/media/media_mimeref.asp
    http://www.bpositive.net/Resources/Charts/mimetype.asp
    und kommt vor in RFC 1844:
    http://www.faqs.org/rfcs/rfc1844.html

    http://filext.com/detaillist.php?extdetail=doc
    hat noch ein paar weitere MIME-Typen fuer MS-Word zur Auswahl:
    application/msword
    application/doc
    appl/text
    application/vnd.msword
    application/vnd.ms-word
    application/winword
    application/word
    application/x-msw6
    application/x-msword
    zz-application/zz-winassoc-doc

    header("Content-Type: text/txt");

    Auch falsch. Richtig waere:
    text/plain
    fuer Normale Text-Dateien.
    Es gibt auch
    text/comma-separated-values
    fuer CSV-Dateien, aber damit wissen wohl die meisten
    Browser nichts anzufangen und schlagen dann den
    Download vor.

    Gruesse,

    Thomas

    --
    Bitte keine Mails mit Fachfragen - dafuer gibt es das Forum!
    Ich mag es, wenn URLs verlinkt sind (</faq/#Q-19>).
    Oft gestellte PHP-Fragen beantwortet die dclp-FAQ bestens: http://www.dclp-faq.de/
    1. Hallo,

      da sag ich mal DANKE!