Op http://nl.php.net/manual/en/features.file-upload.errors.php valt te lezen dat er de volgende errornummers uit $_FILES['userfilebla']['error'] komen:
Maar nu, hoe krijg ik dan -zonder zelf een array te definiëren- aan de tekst komen ipv het getal?
Of is dat gewoon niet mogelijk?
Dus als ik $_FILES['userbla']['error'] echo krijg ik daar een getal uit. Leuk, maar hoe kan ik de constante die bij deze error hoort echoen? Bijv het nummer is 4 dat ik dat dan kan herleiden naar UPLOAD_ERR_NO_FILE. Een arraytje maken is idd zo gedaan, maar ik neem aan dat deze gegevens al ergens in een array van php zitten. Via http://www.php.net/manual...get-defined-constants.php zijn alle gedefineerde constante te bekijken. Daar staan ze inderdaad tussenUPLOAD_ERR_OK
Value: 0; There is no error, the file uploaded with success.
UPLOAD_ERR_INI_SIZE
Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.
UPLOAD_ERR_FORM_SIZE
Value: 2; The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
UPLOAD_ERR_PARTIAL
Value: 3; The uploaded file was only partially uploaded.
UPLOAD_ERR_NO_FILE
Value: 4; No file was uploaded.
UPLOAD_ERR_NO_TMP_DIR
Value: 6; Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.
Aan die wijsheid kom je via-knip-
[UPLOAD_ERR_OK] => 0
[UPLOAD_ERR_INI_SIZE] => 1
[UPLOAD_ERR_FORM_SIZE] => 2
[UPLOAD_ERR_PARTIAL] => 3
[UPLOAD_ERR_NO_FILE] => 4
[UPLOAD_ERR_NO_TMP_DIR] => 6
-knip-
PHP:
1
2
3
| <?php print_r(get_defined_constants()); ?> |
Maar nu, hoe krijg ik dan -zonder zelf een array te definiëren- aan de tekst komen ipv het getal?
Of is dat gewoon niet mogelijk?