Question
Is it possible to stream an uploading file over PHP, so that an other client can download it while the first one is uploading?
I don’t want to save the file permanently on the server. How can I do that?
Why PHP?
The downloading client shouldn’t need an additional software to get the stream. I thought the easiest way would be the webbrowser.
It’s possible, but the implementation is going to be rather awkward. The main obstacle is that the handling of multipart POST request is hardcoded into PHP. It will always save the files to temporary locations before invoking your script. One workaround is to set up PHP-CLI as a CGI script. As the CLI version of PHP is not HTTP-aware, it lets you get your hands on the incoming data.
The .CGI file will look something like this:
Parsing the RFC1867 request is non-trivial. Coordinating the uploading party with the downloading party will also be rather tricky, I imagine.