Close Apache connection with too large file uploads

Viewed 3940

I am currently working on a website where users can upload files. How can I prevent large files to be uploaded? At the time, no option (PHP’s post_max_size and upload_max_filesize) has been useful: the file is uploaded entirely. I would simply like the connection to be closed with too large files (by checking Content-Length HTTP header beforehand, and by checking while the file is being uploaded). Is there an Apache directive, or a PHP configuration key for this?

Thank you for your time!

EDIT: added Apache conf (CentOS default).
EDIT2: added PHP conf (CentOS default) as well.

EDIT3: It seems that PHP closes the pipe when given a too large file. Nevertheless, Apache still allows transfer til it ends.

2 Answers
Related