PHP readfile() adding extra bytes to downloaded file

前端 未结 6 1028
难免孤独
难免孤独 2020-12-06 21:49

I am trying to troubleshoot an issue I am having with downloading a \"zip\" file from a php script. It seems that when I download the file using the following code, the dow

6条回答
  •  天涯浪人
    2020-12-06 22:21

    I ran into a similar issue today related to readfile(). It turns out my php.ini file has output compression enabled and that was messing up the flash module trying to retrieve the file. (I guess it couldn't handle it.)

    All I had to do was the turn off the compression in the php.ini file:

    zlib.output_compression = off
    

    Or alternatively, in your script:

     
    

    Just want to share this in case someone else was having trouble receiving files from a readfile() output.

提交回复
热议问题