Resumable downloads when using PHP to send the file?

后端 未结 13 1062
梦毁少年i
梦毁少年i 2020-11-22 12:22

We are using a PHP scripting for tunnelling file downloads, since we don\'t want to expose the absolute path of downloadable file:

header(\"Content-Type: $ct         


        
13条回答
  •  一整个雨季
    2020-11-22 13:04

    A really nice way to solve this without having to "roll your own" PHP code is to use the mod_xsendfile Apache module. Then in PHP, you just set the appropriate headers. Apache gets to do its thing.

    header("X-Sendfile: /path/to/file");
    header("Content-Type: application/octet-stream");
    header("Content-Disposition: attachment; file=\"filename\"");
    

提交回复
热议问题