faqts : Computers : Programming : Languages : PHP : kms : General

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

42 of 48 people (88%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

Can I return other file formats (like Word, Excel, etc) using PHP?

Apr 29th, 2001 20:19
Philip Olson, Nathan Wallace,


As long as you know how to output data in those formats that is easy. 
All you need to do is to set the Content-Type:  header to the respective
MIME type of the output format.  For instance for the Excel format you
would do:
    Header("Content-Type: application/vnd.ms-excel");
If you want to set the file name of outputted data you may want to do as
follows:
    Header("Content-Location: ". $file_name);
    Header("Content-Disposition: filename=". $file_name);
Be sure to view this tutorial (and user comments) :
    COM Functions in PHP4 (Windows)                      :
    ------------------------------------------------------
    http://phpbuilder.com/columns/alain20001003.php3