PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi, I am currently working on an file upload script and upon filtering the file to upload, the compiler doesnt seem to recognized the following error constants that is from the manual:
// ...
}elseif($error==UPLOAD_ERR_NO_TMP_DIR){
$this->message = "<font color=red><b>Server Error:</b></font><br>A problem occured while upload file. Please try again later.";
ReportError("Temporay folder used in uploading does not exists. Check PHP.ini");
}elseif($error==UPLOAD_ERR_CANT_WRITE){
$this->message = "<font color=red><b>Server Error:</b></font><br>A problem occured while upload file. Please try again later.";
ReportError("Uploading -> Cannot write to hard disk.");
//...
Here it is the error
Notice: Use of undefined constant UPLOAD_ERR_NO_TMP_DIR - assumed 'UPLOAD_ERR_NO_TMP_DIR' in C:\Inetpub\wwwroot\intranet\scripts\reportupdate_inc.php on line 149
// Define Upload Error Constants
if (!defined('UPLOAD_ERR_OK')) {
define('UPLOAD_ERR_OK', 0);
// There is no error, the file uploaded with success.
}
if (!defined('UPLOAD_ERR_INI_SIZE')) {
define('UPLOAD_ERR_INI_SIZE', 1);
// The uploaded file exceeds the upload_max_filesize directive in php.ini.
}
if (!defined('UPLOAD_ERR_FORM_SIZE')) {
define('UPLOAD_ERR_FORM_SIZE', 2);
// The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.
}
if (!defined('UPLOAD_ERR_PARTIAL')) {
define('UPLOAD_ERR_PARTIAL', 3);
// The uploaded file was only partially uploaded.
}
if (!defined('UPLOAD_ERR_NO_FILE')) {
define('UPLOAD_ERR_NO_FILE', 4);
// No file was uploaded.
}
if (!defined('UPLOAD_ERR_NO_TMP_DIR')) {
define('UPLOAD_ERR_NO_TMP_DIR', 6);
// Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.
}
if (!defined('UPLOAD_ERR_CANT_WRITE')) {
define('UPLOAD_ERR_NO_CANT_WRITE', 7);
// Failed to write file to disk. Introduced in PHP 5.1.0.
}