The content is empty after Excel on IE

Source: Internet
Author: User
Tags ranges
The content is empty after IE in Excel

$name = ' 1.xls ';
$file = fopen ($name, "RB"); Open File
Header (' Content-type:application/octet-stream;charset=utf-8 ');
Header ("Content-type:application/force-download");
Header (' accept-ranges:bytes ');
Header (' accept-length: '. FileSize ($name));
Header (' content-disposition:attachment; Filename= '. $filename. ');
Echo fread ($file, FileSize ($name));
Fclose ($file);


With Firefox and Google download is normal, and after the download of IE file content is empty.


------Solution--------------------
$name = ' 1.xls ';
$file = fopen ($name, "RB"); Open File
Header (' Content-type:application/octet-stream;charset=utf-8 ');
Header ("Content-type:application/force-download");
Header (' accept-ranges:bytes ');
Header (' accept-length: '. FileSize ($name));
Header (' content-disposition:attachment; Filename= '. $name. ');
ReadFile ($name);
Fclose ($file);

Give it a try.
------Solution--------------------
Then I don't know. I heard there are a lot of 360 browser problems. It's best not to avoid it.

I don't have 360 browsers, and I can't test it for you.
------Solution--------------------
Do not use this method, you have to download a phpexecl plug-in use, the site can be downloaded directly, not subject to any browser problems
http://phpexcel.codeplex.com/Download Address
------Solution--------------------
Agree to the 6 floor proposal. Phpexcel is really powerful. References: Do
not use this method, you have to download a phpexecl plug-in use, the site can be downloaded directly, not subject to any browser problems
http://phpexcel.codeplex.com/Download Address

------Solution--------------------
Try it with the file_get_contents function?
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.