Stream FTP download to output

后端 未结 6 1179
耶瑟儿~
耶瑟儿~ 2020-12-03 06:06

I am trying to stream/pipe a file to the user\'s browser through HTTP from FTP. That is, I am trying to print the contents of a file on an FTP server.

This is what

6条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-03 06:30

    (I've never met this problem myself, so that's just a wild guess ; but, maybe... )

    Maybe changing the size of the ouput buffer for the "file" you are writing to could help ?

    For that, see stream_set_write_buffer.

    For instance :

    $fp = fopen('php://output', 'w+');
    stream_set_write_buffer($fp, 0);
    

    With this, your code should use a non-buffered stream -- this might help...

提交回复
热议问题