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?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.