Barrie
Barrie

Reputation: 1474

UPLOAD_ERR_INI_SIZE error but post_max_size and upload_max_filesize values look correct

I am trying to upload a file which is 17569997 bytes (~16.7MB).

When performing error checking in my script, I inspect $_FILES['file']['error'] which is set to 1 (UPLOAD_ERR_INI_SIZE - The uploaded file exceeds the upload_max_filesize directive in php.ini).

Upon finding this error, I'm var_dumping out some values and calling phpinfo() just to try and find out what is wrong. The values related to this error are:

post_max_size 34M
upload_max_filesize 32M
max_file_uploads 20
memory_limit 128M

Since $_FILES is actually populated, there isn't a problem with post_max_size. $_SERVER['CONTENT_LENGTH'] is showing 17570308 which seems correct for posting the file + the rest of the form. The server is running PHP 5.3.10 on Ubuntu.

Upvotes: 2

Views: 2583

Answers (1)

Barrie
Barrie

Reputation: 1474

Ok, I worked out what was happening here and this will hopefully save someone else from pulling their hair out. The disk the root file system was sitting on including /tmp was full due to a log filling up (5.5GB). The web root sits on another disk which had plenty of space.

I can only assume that the failure to write to /tmp throws the UPLOAD_ERR_INI_SIZE error. As soon as I cleared up disk space on the root file system, the upload worked first time.

Upvotes: 3

Related Questions