The situation is this: there is an infinitely running php script that generates a large audio file by pasting files from the specified folder (of course, the final size is unknown) and giving the client the resulting file with the content-type header : audio / mpeg .

Problem: hosting has a limit on the size of the file downloaded by the user. There is no access to nginx / php.ini , etc. I am addressing the community with the question: is it possible to somehow segment the stream into parts, for example, 256 KB and send it to the client in chunks? And if so, then ask to share a way.

PS I tried the chunk download method. The file all the same goes to the client monolithically and all the same rests against restriction.

    1 answer 1

    For proper chunk download to work, a title is required:

    header("Accept-Ranges:bytes"); 

    If it didn’t help too, then forbidden tricks are used - reset the page every XXX seconds.

     header("Refresh:XXX");