Code location for file upload

I am having an issue with uploading files from the web gui. Keeps saying not enough space even though there is. Pretty sure its related to using PHP-FPM and/or Apache MPM event. Uploading through webdav or client work fine. Can someone tell me where the code is that does the check for storage space?

Web UI also uses Webdav PUT since OC 9.1+. What OC version are you on ?