Re: downloading xls files corrupts them

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 2009-01-12 13:13:25, schrieb Chris Ditty:
> I am using php to download xls files on my server.   When I download them, excel is saying they are corrupted.  They are not corrupted on the server itself.  These are simple xls spreadsheets with no formatting in them.
> 
> Here is the headers that I am using for the download.  This is happening in both IE and Firefox.
> header("Pragma: public");
> header("Expires: 0");
> header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
> header("Content-Type: application/force-download");
> header("Content-Type: application/octet-stream");
> header("Content-Type: application/download");

Why do you do this three times?  You need only:

    header("Content-Type: application/vnd.ms-excel");

> header("Content-Disposition: attachment; filename=".basename("./bidDocs/".$myFile).";");
> header("Content-Transfer-Encoding: binary");

Remove this line.

> header("Content-Length: ".filesize("./bidDocs/".$myFile));
> readfile("./bidDocs/".$myFile);
> 
> Anyone have any suggestions?

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
<http://www.tamay-dogan.net/>               <http://www.can4linux.org/>
Michelle Konzack   Apt. 917                  ICQ #328449886
+49/177/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)

<<attachment: signature.pgp>>


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux