public function FileUploaded::checkForErrors in N1ED - Visual editor as CKEditor plugin with Bootstrap support 8.2
Returns do we need to continue check or not.
Overrides AFile::checkForErrors
File
- src/
Flmngr/ FileUploaderServer/ lib/ file/ FileUploaded.php, line 46
Class
- FileUploaded
- Uploaded but not commited yet file. Data stucture about file is to be converted to commited file when all validations are passed.
Namespace
Drupal\n1ed\Flmngr\FileUploaderServer\lib\fileCode
public function checkForErrors($checkForExist) {
if (!parent::checkForErrors($checkForExist)) {
return FALSE;
}
if ($this->newName !== $this
->getName() && !Utils::isFileNameSyntaxOk($this->newName)) {
$this->commonErrors[] = Message::createMessage(Message::FILE_ERROR_SYNTAX, $this->newName);
}
if (Utils::isImage($this
->getName())) {
$ext = $this
->getExt();
$newExt = Utils::getExt($this->newName);
if ($ext !== $newExt) {
if (!($ext === "jpg" && $newExt === "jpeg") && !($ext === "jpeg" && $newExt === "jpg")) {
$this->commonErrors[] = Message::createMessage(Message::FILE_ERROR_INCORRECT_IMAGE_EXT_CHANGE, $ext, $newExt);
}
}
}
return TRUE;
}