I'm working on a website where users will need to upload some very large files. The site is written in PHP.
There are some instances where I'll want to reject a file based off the headers. Ideally, I'd like to reject the request as soon as the headers are received without ever reading the body. There's no reason to read a 200M file if the header is enough to tell that the file should be rejected. Additionally, when I do accept a request, I'd like to periodically save the number of bytes read as the request body is received.
I know this is impossible with PHP because the entire HTTP request is read before PHP gets its hands on it. What are my alternatives? I've never worked with Perl, but I was reading that mod_perl gives access to the Apache API. Would it be possible to do this using mod_perl? An Apache module?