Reputation: 648
I'm trying to debug a very strange problem with the $_FILES array. When I try to upload a file, only the 'name' key is set, the type, tmp_name, etc. are empty, and it's returning error #1. For example:
Array
(
[name] => test.doc
[type] =>
[tmp_name] =>
[error] => 1
[size] => 0
)
test.doc is a valid file, I can open it without a problem. This is happening to a bunch of files I tested; doc, pdf, xls, ppt, jpg. The only file types that works are txt and gif.
I'm getting this problem on both on 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 I may have been mime types, but I checked the mime types and all the common ones are available.
Any ideas? I've never had this problem before!
Thanks.
Upvotes: 4
Views: 328
Reputation: 162771
According to the PHP documentation on file uploads, an error value of 1
(AKA UPLOAD_ERR_INI_SIZE
) means:
The uploaded file exceeds the upload_max_filesize directive in php.ini.
You can try adjusting the upload-max-filesize
setting.
EDIT: The correct syntax for specifying upload_max_filesize
in megabytes is 25M
, not 25MB
. See the documentation on using shorthand for details.
Upvotes: 5
Reputation:
The error code of 1 means the file exceeds the maximum upload size set in php.ini.
All the various errors messages are explained here: http://php.net/manual/en/features.file-upload.errors.php
Upvotes: 7