PHP readfile() adding extra bytes to downloaded file

前端 未结 6 1013
难免孤独
难免孤独 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:20

    I had a similar issue with blank space at the start of an image file.

    I suspect my issue was caused by blank space before opening

    What worked for me was:

    @ob_start('');  //@ supresses a warning  
    //header entries
    ob_end_clean();
    ob_clean();
    readfile($file);
    

提交回复
热议问题