I'm writing a PHP extension now in c/c++. User uploads a file (could be POST or PUT method, but I can limit it to POST only). I need to capture the file data while being uploaded, without writing it to disk on the server. I need to process the data and (maybe, depending on a situation) send it somewhere else or save it to disk.
Of course I know, that I can process the file after it has been uploaded (saved on disk on the server), but I would like to avoid it. I also need to do something opposite: I need to generate a file "on the fly" and send it
to the user. All metadata of the generated file is known beforehand (e.g. size, name).
I've been searching around for some time now and I could not find anything even close to the solution. Is there any example(s) or existing PHP extension that do(es) something like this (at least something simmilar) ? If you could give me any pointers that would be awesome.