Resumable downloads when using PHP to send the file?

后端 未结 13 1202
梦毁少年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:13

    Yes. Support byteranges. See RFC 2616 section 14.35 .

    It basically means that you should read the Range header, and start serving the file from the specified offset.

    This means that you can't use readfile(), since that serves the whole file. Instead, use fopen() first, then fseek() to the correct position, and then use fpassthru() to serve the file.

提交回复
热议问题