PHP output file on disk to browser

前端 未结 6 2077
轻奢々
轻奢々 2020-11-27 19:18

I want to serve an existing file to the browser in PHP. I\'ve seen examples about image/jpeg but that function seems to save a file to disk and you have to create a right si

6条回答
  •  借酒劲吻你
    2020-11-27 19:56

    For both my website and websites I create for clients I use a PHP script that I found a long time ago.

    It can be found here: http://www.zubrag.com/scripts/download.php

    I use a slightly modified version of it to allow me to obfuscate the file system structure (which it does by default) in addition to not allowing hot linking (default) and I added some additional tracking features, such as referrer, IP (default), and other such data that I might need should something come up.

    Hope this helps.

提交回复
热议问题