The $ _FILES array has only partial information

I am trying to debug a very strange problem with the $ _FILES array. When I try to upload a file, only "name" is set, type, tmp_name, etc. Empty, and it returns error number 1. For instance:

Array ( [name] => test.doc [type] => [tmp_name] => [error] => 1 [size] => 0 ) 

test.doc is a valid file, I can open it without any problems. This happens with a bunch of files that I tested; doc, pdf, xls, ppt, jpg. The only files that work are txt and gif.

I get this problem for both CentOS 5.3 w / PHP 5.2.6, Apache 2.2.3 and Ubuntu 8.04 w / PHP 5.2.4, Apache 2.2.8.

I thought that I might have been a mime type, but I checked the mime types, and all the usual ones are available.

Any ideas? I have never had this problem before!

Thanks.

+4
source share
2 answers

According to PHP's file upload documentation , an error value of 1 (AKA UPLOAD_ERR_INI_SIZE ) means:

The downloaded file exceeds the upload_max_filesize directive in php.ini.

You can try to configure upload-max-filesize .

EDIT: The correct syntax for specifying upload_max_filesize in megabytes is 25M , not 25MB . See the abbreviation documentation for more details.

+5
source

Error code 1 means that the file exceeds the maximum upload size specified in php.ini.

All error messages are described here: http://php.net/manual/en/features.file-upload.errors.php

+7
source

Source: https://habr.com/ru/post/1299379/


All Articles