How do I get client_max_body_size (nginx - php-fpm) as a value in PHP?

Viewed 1334

I have written a file uploader for a custom app that breaks the file up into chunks and sends it to the server via ajax. The issue I have is that I can pull the upload_max_filesize and post_max_size using ini_get, however, I cannot seem to get the client_max_body_size that nginx uses to dole out the 413 errors; and the answer space is polluted with people trying to up the limit. I want my software to detect and work around the limit (since it already chunks things so well). How can I detect client_max_body_size (or any other potential limit values) as a value in php (ideally in a generic manner that doesn't require modifying nginx files, so that code is drop in ready for the public, but i'll take what I can get). Thanks in advance!

1 Answers

I guess the most sensible thing to do then is to hard code it in the config so that people can target their environments to their limitations manually. I was hoping there was a better generic solution, but I guess there is not.

Related