开发者

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

开发者 https://www.devze.com 2023-04-10 05:19 出处:网络
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 decidin

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?


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消