php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #18286 UPLOAD_ERROR_X constants differ from documentation
Submitted: 2002-07-11 17:22 UTC Modified: 2003-01-18 18:27 UTC
From: powerlord at vgmusic dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.0 OS: Linux 2.4.x
Private report: No CVE-ID: None
 [2002-07-11 17:22 UTC] powerlord at vgmusic dot com
I am using PHP on Apache 1.3.26.

When attempting to use the UPLOAD_ERROR_A through UPLOAD_ERROR_E constants, they return the following:
UPLOAD_ERROR_A returns the string UPLOAD_ERROR_A
UPLOAD_ERROR_B returns the string UPLOAD_ERROR_B
UPLOAD_ERROR_C returns the string UPLOAD_ERROR_C
UPLOAD_ERROR_D returns the string UPLOAD_ERROR_D
UPLOAD_ERROR_E returns the string UPLOAD_ERROR_E

This is what *should* happen according to documentation:
UPLOAD_ERROR_A should return the value 1
UPLOAD_ERROR_B should return the value 2
UPLOAD_ERROR_C should return the value 3
UPLOAD_ERROR_D should return the value 4
UPLOAD_ERROR_E should return the value 5

This is reproducible using <?php echo UPLOAD_ERROR_A ?> (Please note the lack of quotes before marking this as bogus).

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-11 18:10 UTC] philip@php.net
The documentation at features.file-upload.errors is a little unclear on this matter.  Are these suppose to be PHP constants too?

See also:
* http://marc.theaimsgroup.com/?l=php-dev&m=101246726632633
* http://lxr.php.net/source/php4/main/rfc1867.c

Btw, they return those strings because they are undefined.  print ANYTHING; will do that and throw an error of level E_NOTICE.
 [2002-07-12 00:45 UTC] powerlord at vgmusic dot com
I see, they aren't constants at all, but error messages caught on E_NOTICE.  The way they are listed on the features.file-upload.errors page (since it lists error numbers in reference to them) in association with the value of $_FILES["userfile"]["error"] implies that they are constants.

It would be really handy if $_FILES["userfile"]["error"] and $userfile_error were mentioned in the features.file-upload section along with the relevant error numbers.
 [2002-07-12 00:52 UTC] sniper@php.net
These constants exist as of today (in CVS):

value - constant name - description

0 - UPLOAD_ERR_OK - No errors, upload succesful
1 - UPLOAD_ERR_INI_SIZE  - Filesize exceeded upload_max_filesize
2 - UPLOAD_ERR_FORM_SIZE - Filesize exceeded MAX_FILE_SIZE set in the form
3 - UPLOAD_ERR_PARTIAL - File uploaded partially. 
4 - UPLOAD_ERR_NO_FILE - No file uploaded.

If those names are not good, feel free to come up with 
better ones. :)

 [2002-07-12 16:59 UTC] powerlord at vgmusic dot com
Sounds great, but how about adding:

5 - UPLOAD_ERR_ZERO_SIZE - uploaded file is 0 bytes

I get the impression that error 5 hasn't been around long. :)
 [2002-07-12 17:31 UTC] sniper@php.net
zero sized uploads -> no upload at all. Tey don't end up in the $_FILES (anymore) 
 
 [2002-07-12 17:39 UTC] goba@php.net
From what version? They end up in files in 4.1.2/win as I have experienced...
 [2003-01-18 18:27 UTC] philip@php.net
Empty files exist in $_FILES just the same, nothing to document here.  ['size'] will be 0.

But anyway these new constants are documented.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Aug 17 01:01:29 2024 UTC