Re: downloading xls files corrupts them
| From: | Michelle Konzack | Date: | Tue, 13 Jan 2009 18:14:06 +0000 |
| Subject: | Re: downloading xls files corrupts them | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-286242@lists.php.net to get a copy of this message | ||
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)