fix should check the negative

This commit is contained in:
David Pareja Rodriguez 2023-03-01 10:11:55 +01:00
parent 2a706411cf
commit 0e9451e100

View File

@ -206,10 +206,10 @@ class FileUpload
if (!key_exists("upload_dir", $this->options)) {
setEventMessage('If $fk_element = null or $element = null you must specify upload_dir on $options', 'errors');
throw new Exception('If $fk_element = null or $element = null you must specify upload_dir on $options');
} elseif (is_dir($this->options['upload_dir'])) {
} elseif (!is_dir($this->options['upload_dir'])) {
setEventMessage('The directory '.$this->options['upload_dir'].' doesn\'t exists', 'errors');
throw new Exception('The directory '.$this->options['upload_dir'].' doesn\'t exists');
} elseif (is_writable($this->options['upload_dir'])) {
} elseif (!is_writable($this->options['upload_dir'])) {
setEventMessage('The directory '.$this->options['upload_dir'].' is not writable', 'errors');
throw new Exception('The directory '.$this->options['upload_dir'].' is not writable');
}