totallyNotLizards
totallyNotLizards

Reputation: 8569

If you upload a file to PHP that exceeds upload_max_filesize, does the upload terminate?

As in title.

I have a upload_max_filesize limit of 2meg, if I upload a 3meg file will it stop uploading after 2megs or carry on until the full 3megs have been uploaded before deciding it's too big?

Upvotes: 6

Views: 262

Answers (2)

Pekka
Pekka

Reputation: 449605

will it stop uploading after 2megs or carry on until the full 3megs have been uploaded before deciding it's too big?

The full 3 megs will be uploaded. The request is only then passed on to PHP, which will decide that it's too big.

The error flag will be populated as pointed out by @Steve.

IIRC, it's different if you hit Apache's LimitRequestBody size: The request will be terminated immediately upon hitting the limit and an error page displayed.

Upvotes: 4

Phix
Phix

Reputation: 9910

It won't even begin. It'll populate the $_FILES['filename']['error'] with the UPLOAD_ERR_INI_SIZE constant.

http://www.php.net/manual/en/features.file-upload.errors.php

Upvotes: -2

Related Questions