I have set upload limit to 3M in php.ini. If someone uploads a file that is 50 mb, then does the upload stop when it hits 3Mb or does it continue until the upload is complete, then reads the filesize and deletes the file?
If you're using Apache as your web server, then PHP doesn't get a chance to start until the request completes. Thus, the upload limit only comes into action after the whole upload finishes. Apache first receives the entire request, and only then does it invoke the appropriate handler (in this case, PHP). Since there is no server-side mechanism to abort a HTTP request in progress and return a response, you'll need to wait until the whole request is complete.
So, to answer your question: NO, the upload will go through in full; PHP's internal logic will check the uploaded file size, see that it's larger than the limit, and then fail immediately with an error. Your PHP script will not get a chance to run, so don't rely on runtime checks - they won't be executed at all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With