Files sometimes download as .PHP instead of .PDF?

后端 未结 1 1807
借酒劲吻你
借酒劲吻你 2020-12-10 20:19

I\'m working on a script that allows users to download files stored online. It always seems to work with image files, but with PDF\'s the browser sometimes downloads .PHP fi

1条回答
  •  爱一瞬间的悲伤
    2020-12-10 20:47

    Adding ob_clean(); and flush(); functions before the readfile(); function, could be something worth using, as per what the PHP manual states on the subject.

    readfile() http://php.net/manual/en/function.readfile.php

    ob_clean() http://php.net/manual/en/function.ob-clean.php

    flush() http://php.net/manual/en/function.ob-flush.php

    These functions are not present in your posted code.

    0 讨论(0)
提交回复
热议问题