Und zwar geht es hier um diesen Block:
Code: Alles auswählen
$upload = $files_factory->get('files.upload')
->set_error_prefix($error_prefix)
->set_allowed_extensions($allowed_extensions)
->set_max_filesize($max_filesize)
->set_allowed_dimensions($min_width, $min_height, $max_width, $max_height)
->set_disallowed_content($disallowed_content)
->handle_upload('files.types.local', $local_storage, $local_filedata);
Und zwar wird in diesem block ja die Datei geprüft auf erlaubte Endung, Dateigröße, länge mal breite und verbotenen Inhalt. Und entsprechend eine Fehlermeldung ausgegeben.
Ich poste anbei mal meinen Block zum anschauen:
Code: Alles auswählen
$allowed_extensions = ['png', 'jpg', 'jpeg', 'gif'];
$allowed_file_size = 5242880;
$min_width = 5;
$min_height = '5';
$max_width = 10;
$max_height = '10';
schreibe diese Prüfung wird schlicht einfach nicht ausgeführt. Alles andere funktioniert so wie es soll.
$fileupload = $this->files_factory->get('files.upload')
->set_error_prefix('HEADERPIC_')
->set_allowed_extensions($allowed_extensions)
->set_max_filesize($allowed_file_size)
->set_allowed_dimensions($min_width, $min_height, $max_width, $max_height)
->handle_upload('files.types.form', 'chris1278_headerbar_filename');
$upload_path = 'images/headerlogo/'; //Das Upload-Verzeichnis
if (!$this->filesystem->exists($this->root_path . $upload_path))
{
$this->filesystem->mkdir($this->root_path . $upload_path, 0777, true);
}
if (!$this->filesystem->is_writable($this->root_path . $upload_path))
{
$no_write = false;
$errors[] = $this->language->lang('ACP_HEADERBAR_DIRECTORY_NOT_WRITETABLE', generate_board_url() . '/' .$upload_path);
}
$filename = $fileupload->get('uploadname');
if (!empty($filename) && empty($upload_file->error) && $no_write)
{
if (!empty($this->config['chris1278_headerbar_filename']))
{
$this->filesystem->remove($this->root_path . $upload_path . $this->config['chris1278_headerbar_filename']);
}
$this->config->set('chris1278_headerbar_filename', $filename);
$fileupload->move_file($upload_path, true, true, 0644);
trigger_error($this->language->lang('ACP_HEADERLOGO_SETTING_SAVED') . adm_back_link($this->u_action));
}
else if (!empty($fileupload->error))
{
foreach ($fileupload->error as $error_row)
{
$s_errors = !empty($errors);
$errors[] = $error_row;
$this->template->assign_vars([
'CHRIS1278_S_ERROR' => $s_errors,
'CHRIS1278_ERROR_MSG' => $s_errors ? implode('<br />', $errors) : '',
]);
}
}
}
Vielleicht kann mir einer hier sagen warum das nicht funktioniert. es speilt hier auch keine rolle ob ich das so:
Code: Alles auswählen
$min_width = 5;
$min_height = 5;
$max_width = 10:
$max_height = 10;
Code: Alles auswählen
$min_width = '5';
$min_height = '5';
$max_width = '10';
$max_height = '10';