From dda060f92e1026a9df2dd9629b9b6d4cfa11955a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maur=C3=ADcio=20Meneghini=20Fauth?= Date: Wed, 13 May 2020 16:57:14 -0300 Subject: [PATCH] Replace file upload error codes with PHP contants MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MaurĂ­cio Meneghini Fauth --- libraries/classes/File.php | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/libraries/classes/File.php b/libraries/classes/File.php index 922d7f394f68..7d1aa05c6eb5 100644 --- a/libraries/classes/File.php +++ b/libraries/classes/File.php @@ -1,11 +1,17 @@ setUploadedFile($file['tmp_name']); - case 4: //UPLOAD_ERR_NO_FILE: + case UPLOAD_ERR_NO_FILE: break; - case 1: //UPLOAD_ERR_INI_SIZE: + case UPLOAD_ERR_INI_SIZE: $this->_error_message = Message::error(__( 'The uploaded file exceeds the upload_max_filesize directive in ' . 'php.ini.' )); break; - case 2: //UPLOAD_ERR_FORM_SIZE: + case UPLOAD_ERR_FORM_SIZE: $this->_error_message = Message::error(__( 'The uploaded file exceeds the MAX_FILE_SIZE directive that was ' . 'specified in the HTML form.' )); break; - case 3: //UPLOAD_ERR_PARTIAL: + case UPLOAD_ERR_PARTIAL: $this->_error_message = Message::error(__( 'The uploaded file was only partially uploaded.' )); break; - case 6: //UPLOAD_ERR_NO_TMP_DIR: + case UPLOAD_ERR_NO_TMP_DIR: $this->_error_message = Message::error(__('Missing a temporary folder.')); break; - case 7: //UPLOAD_ERR_CANT_WRITE: + case UPLOAD_ERR_CANT_WRITE: $this->_error_message = Message::error(__('Failed to write file to disk.')); break; - case 8: //UPLOAD_ERR_EXTENSION: + case UPLOAD_ERR_EXTENSION: $this->_error_message = Message::error(__('File upload stopped by extension.')); break; default: $this->_error_message = Message::error(__('Unknown error in file upload.')); - } // end switch + } return false; }