23-01-2026
This commit is contained in:
parent
8fd1f4d451
commit
389d5d1820
59 changed files with 9642 additions and 883 deletions
|
|
@ -112,7 +112,7 @@ class LfmController extends Controller
|
|||
{
|
||||
$shared_folder_name = config('lfm.shared_folder_name');
|
||||
$shared_folder = IQContentFolder::where('name', $shared_folder_name)->where('folder_id', null)->first();
|
||||
if(!$shared_folder){
|
||||
if (!$shared_folder) {
|
||||
IQContentFolder::create([
|
||||
'folder_id' => null,
|
||||
'name' => $shared_folder_name,
|
||||
|
|
|
|||
|
|
@ -25,46 +25,98 @@ class UploadController extends LfmController
|
|||
*/
|
||||
public function upload()
|
||||
{
|
||||
$uploaded_files = request()->file('upload');
|
||||
$error_bag = [];
|
||||
$new_filename = null;
|
||||
try {
|
||||
// Prüfe, ob überhaupt Dateien hochgeladen wurden
|
||||
$uploaded_files = request()->file('upload');
|
||||
$error_bag = [];
|
||||
$new_filename = null;
|
||||
|
||||
foreach (is_array($uploaded_files) ? $uploaded_files : [$uploaded_files] as $file) {
|
||||
try {
|
||||
$new_filename = $this->lfm->upload($file);
|
||||
} catch (\Exception $e) {
|
||||
Log::error($e->getMessage(), [
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine(),
|
||||
'trace' => $e->getTraceAsString()
|
||||
// Prüfe auf post_max_size Überschreitung
|
||||
if (empty($uploaded_files) && empty($_FILES) && $_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
$postMaxSize = ini_get('post_max_size');
|
||||
$uploadMaxSize = ini_get('upload_max_filesize');
|
||||
|
||||
$error_bag[] = "Die Datei ist zu groß für den Upload. " .
|
||||
"Maximale Uploadgröße: {$uploadMaxSize}. " .
|
||||
"Maximale POST-Größe: {$postMaxSize}. " .
|
||||
"Bitte kontaktieren Sie den Administrator, um die Limits zu erhöhen.";
|
||||
|
||||
Log::error('Upload fehlgeschlagen: post_max_size oder upload_max_filesize überschritten', [
|
||||
'post_max_size' => $postMaxSize,
|
||||
'upload_max_filesize' => $uploadMaxSize,
|
||||
'content_length' => $_SERVER['CONTENT_LENGTH'] ?? 'unknown'
|
||||
]);
|
||||
array_push($error_bag, $e->getMessage());
|
||||
}
|
||||
}
|
||||
} elseif (empty($uploaded_files)) {
|
||||
$error_bag[] = "Es wurde keine Datei zum Upload ausgewählt.";
|
||||
} else {
|
||||
foreach (is_array($uploaded_files) ? $uploaded_files : [$uploaded_files] as $file) {
|
||||
try {
|
||||
$new_filename = $this->lfm->upload($file);
|
||||
} catch (\Exception $e) {
|
||||
$errorMessage = $e->getMessage();
|
||||
|
||||
if (is_array($uploaded_files)) {
|
||||
$response = count($error_bag) > 0 ? $error_bag : parent::$success_response;
|
||||
} else { // upload via ckeditor5 expects json responses
|
||||
if (is_null($new_filename)) {
|
||||
$response = ['error' =>
|
||||
[
|
||||
'message' => $error_bag[0]
|
||||
// Sicherstellen, dass die Fehlermeldung ein String ist
|
||||
if (is_object($errorMessage) || is_array($errorMessage)) {
|
||||
$errorMessage = json_encode($errorMessage);
|
||||
}
|
||||
|
||||
Log::error('Upload-Fehler: ' . $errorMessage, [
|
||||
'file_name' => $file ? $file->getClientOriginalName() : 'unknown',
|
||||
'file_size' => $file ? $file->getSize() : 0,
|
||||
'error_file' => $e->getFile(),
|
||||
'error_line' => $e->getLine(),
|
||||
'trace' => $e->getTraceAsString()
|
||||
]);
|
||||
|
||||
array_push($error_bag, $errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Fehlerbehandlung
|
||||
if (count($error_bag) > 0) {
|
||||
$errorMsg = isset($error_bag[0]) ? $error_bag[0] : 'Unbekannter Upload-Fehler';
|
||||
|
||||
// Einheitliches Fehlerformat für Frontend
|
||||
$response = [
|
||||
'error' => [
|
||||
'message' => $errorMsg
|
||||
]
|
||||
];
|
||||
} else {
|
||||
|
||||
/*$response = view(Lfm::PACKAGE_NAME . '::use')
|
||||
->withFile($this->lfm->setName($new_filename)->url());
|
||||
*/
|
||||
// HTTP 400 Status für Fehler
|
||||
return response()->json($response, 400);
|
||||
}
|
||||
|
||||
// Erfolgreiche Antwort
|
||||
if (is_array($uploaded_files)) {
|
||||
$response = parent::$success_response;
|
||||
} else { // upload via ckeditor5 expects json responses
|
||||
$url = $this->lfm->setName($new_filename)->url();
|
||||
|
||||
$response = [
|
||||
'url' => $url
|
||||
];
|
||||
}
|
||||
|
||||
return response()->json($response);
|
||||
} catch (\Exception $e) {
|
||||
// Fange alle unerwarteten Fehler ab
|
||||
Log::error('Unerwarteter Upload-Fehler: ' . $e->getMessage(), [
|
||||
'error_file' => $e->getFile(),
|
||||
'error_line' => $e->getLine(),
|
||||
'trace' => $e->getTraceAsString(),
|
||||
'request_data' => [
|
||||
'content_length' => $_SERVER['CONTENT_LENGTH'] ?? 'unknown',
|
||||
'post_max_size' => ini_get('post_max_size'),
|
||||
'upload_max_filesize' => ini_get('upload_max_filesize'),
|
||||
]
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'error' => [
|
||||
'message' => 'Ein unerwarteter Fehler ist aufgetreten: ' . $e->getMessage()
|
||||
]
|
||||
], 500);
|
||||
}
|
||||
return response()->json($response);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use phpDocumentor\Reflection\DocBlock\Tags\Return_;
|
|||
use Symfony\Component\HttpFoundation\File\UploadedFile;
|
||||
use IqContent\LaravelFilemanager\Events\ImageIsUploading;
|
||||
use IqContent\LaravelFilemanager\Events\ImageWasUploaded;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class LfmPath
|
||||
{
|
||||
|
|
@ -65,18 +66,18 @@ class LfmPath
|
|||
{
|
||||
$parent_folder_id = $this->getModelParentFolderId();
|
||||
if ($this->isDirectory()) {
|
||||
if($this->folder_model == null){
|
||||
if($parent_folder_id){
|
||||
if ($this->folder_model == null) {
|
||||
if ($parent_folder_id) {
|
||||
$this->folder_model = IQContentFolder::where('name', $this->item_name)->where('folder_id', $parent_folder_id)->first();
|
||||
} else{
|
||||
} else {
|
||||
$this->folder_model = new IQContentFolder();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if($this->file_model == null){
|
||||
if($parent_folder_id){
|
||||
} else {
|
||||
if ($this->file_model == null) {
|
||||
if ($parent_folder_id) {
|
||||
$this->file_model = IQContentFile::where('name', $this->item_name)->where('folder_id', $parent_folder_id)->first();
|
||||
}else{
|
||||
} else {
|
||||
$this->file_model = new IQContentFile();
|
||||
}
|
||||
}
|
||||
|
|
@ -94,27 +95,29 @@ class LfmPath
|
|||
{
|
||||
if ($this->isDirectory()) {
|
||||
return $this->folder_model;
|
||||
}else{
|
||||
} else {
|
||||
return $this->file_model;
|
||||
}
|
||||
}
|
||||
|
||||
public function getModelParentFolderId(){
|
||||
public function getModelParentFolderId()
|
||||
{
|
||||
$parent_folder = $this->getModelFolderByPath();
|
||||
if($parent_folder) {
|
||||
if ($parent_folder) {
|
||||
return $parent_folder->id;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public function getModelFolderByPath($parent = false){
|
||||
public function getModelFolderByPath($parent = false)
|
||||
{
|
||||
$working_dir = $this->path('working_dir');
|
||||
$working_dir = substr($working_dir, 0, strrpos($working_dir, '/'));
|
||||
$dirs = explode( "/", $working_dir);
|
||||
$dirs = explode("/", $working_dir);
|
||||
$folder_id = null;
|
||||
$folder = null;
|
||||
foreach ($dirs as $dir){
|
||||
foreach ($dirs as $dir) {
|
||||
$folder = IQContentFolder::where('name', $dir)->where('folder_id', $folder_id)->first();
|
||||
if($folder){
|
||||
if ($folder) {
|
||||
$folder_id = $folder->id;
|
||||
$this->parent_dir = $folder;
|
||||
}
|
||||
|
|
@ -156,7 +159,7 @@ class LfmPath
|
|||
|
||||
public function url()
|
||||
{
|
||||
return $this->storage->url($this->path('url'));
|
||||
return $this->storage->url($this->path('url'));
|
||||
}
|
||||
|
||||
public function folders()
|
||||
|
|
@ -171,16 +174,16 @@ class LfmPath
|
|||
return $this->sortByColumn($folders);
|
||||
}
|
||||
|
||||
public function recrusiveFolders($parent){
|
||||
public function recrusiveFolders($parent)
|
||||
{
|
||||
$folders = $this->folders();
|
||||
$b = [];
|
||||
foreach ($folders as $folder){
|
||||
foreach ($folders as $folder) {
|
||||
$b[$folder->name()] = $folder;
|
||||
$lfm = $folder->getLfm();
|
||||
$lfm->dir($parent);
|
||||
$a = $lfm->recrusiveFolders($folder->url());
|
||||
$b[$folder->name()."-childs"] = $a;
|
||||
|
||||
$b[$folder->name() . "-childs"] = $a;
|
||||
}
|
||||
return $b;
|
||||
}
|
||||
|
|
@ -229,19 +232,18 @@ class LfmPath
|
|||
$parent_folder_id = $this->getModelParentFolderId();
|
||||
$this->storage->makeDirectory(0777, true, true);
|
||||
|
||||
if(!$this->is_thumb){
|
||||
if (!$this->is_thumb) {
|
||||
IQContentFolder::create([
|
||||
'folder_id' => $parent_folder_id,
|
||||
'name' => $this->item_name,
|
||||
'identifier' => $this->item_name,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function isDirectory()
|
||||
{
|
||||
if($this->isDirectory !== null){
|
||||
if ($this->isDirectory !== null) {
|
||||
return $this->isDirectory;
|
||||
}
|
||||
$working_dir = $this->path('working_dir');
|
||||
|
|
@ -313,7 +315,7 @@ class LfmPath
|
|||
public function upload($file)
|
||||
{
|
||||
$error = $this->uploadValidator($file);
|
||||
if($error !== 'pass'){
|
||||
if ($error !== 'pass') {
|
||||
return false;
|
||||
}
|
||||
$new_file_name = $this->getNewName($file);
|
||||
|
|
@ -325,8 +327,12 @@ class LfmPath
|
|||
try {
|
||||
$new_file_name = $this->saveFile($file, $new_file_name);
|
||||
} catch (\Exception $e) {
|
||||
\Log::info($e);
|
||||
return $this->error('invalid');
|
||||
Log::error('File upload failed: ' . $e->getMessage(), [
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine(),
|
||||
'trace' => $e->getTraceAsString()
|
||||
]);
|
||||
throw new \Exception($this->helper->getError('invalid') . ' ' . $e->getMessage());
|
||||
}
|
||||
IQContentFile::create([
|
||||
'folder_id' => $working_folder_id,
|
||||
|
|
@ -339,7 +345,7 @@ class LfmPath
|
|||
'content' => '',
|
||||
]);
|
||||
// TODO should be "FileWasUploaded"
|
||||
// event(new ImageWasUploaded($new_file_path));
|
||||
// event(new ImageWasUploaded($new_file_path));
|
||||
return $new_file_name;
|
||||
}
|
||||
|
||||
|
|
@ -352,7 +358,21 @@ class LfmPath
|
|||
} elseif ($file->getError() == UPLOAD_ERR_INI_SIZE) {
|
||||
return $this->error('file-size', ['max' => ini_get('upload_max_filesize')]);
|
||||
} elseif ($file->getError() != UPLOAD_ERR_OK) {
|
||||
throw new \Exception('File failed to upload. Error code: ' . $file->getError());
|
||||
$errorCode = $file->getError();
|
||||
$errorMessages = [
|
||||
UPLOAD_ERR_INI_SIZE => 'upload-1',
|
||||
UPLOAD_ERR_FORM_SIZE => 'upload-2',
|
||||
UPLOAD_ERR_PARTIAL => 'upload-3',
|
||||
UPLOAD_ERR_NO_FILE => 'upload-4',
|
||||
UPLOAD_ERR_NO_TMP_DIR => 'upload-6',
|
||||
UPLOAD_ERR_CANT_WRITE => 'upload-7',
|
||||
UPLOAD_ERR_EXTENSION => 'upload-8',
|
||||
];
|
||||
|
||||
$errorKey = isset($errorMessages[$errorCode]) ? $errorMessages[$errorCode] : 'upload-unknown';
|
||||
$errorParams = $errorKey === 'upload-unknown' ? ['code' => $errorCode] : [];
|
||||
|
||||
throw new \Exception($this->helper->getError($errorKey, $errorParams));
|
||||
}
|
||||
|
||||
$new_file_name = $this->getNewName($file);
|
||||
|
|
@ -422,7 +442,7 @@ class LfmPath
|
|||
// generate cropped image content
|
||||
$this->setName($file_name)->thumb(true);
|
||||
$image = Image::make($original_image->get());
|
||||
$this->image_dimensions = $image->width()."x".$image->height();
|
||||
$this->image_dimensions = $image->width() . "x" . $image->height();
|
||||
$image->fit(config('lfm.thumb_img_width', 200), config('lfm.thumb_img_height', 200));
|
||||
|
||||
$this->storage->put($image->stream()->detach());
|
||||
|
|
@ -437,9 +457,8 @@ class LfmPath
|
|||
$this->setName($file_name)->thumb(true);
|
||||
|
||||
$image = Image::make(file_get_contents($url));
|
||||
// $this->image_dimensions = $image->width()."x".$image->height();
|
||||
// $this->image_dimensions = $image->width()."x".$image->height();
|
||||
$image->fit(config('lfm.thumb_img_width', 200), config('lfm.thumb_img_height', 200));
|
||||
$this->storage->put($image->stream()->detach());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ return [
|
|||
'nav-thumbnails' => 'Thumbnails',
|
||||
'nav-list' => 'List',
|
||||
'nav-sort' => 'Sort',
|
||||
'nav-sort-alphabetic'=> 'Sort By Alphabets',
|
||||
'nav-sort-alphabetic' => 'Sort By Alphabets',
|
||||
'nav-sort-time' => 'Sort By Time',
|
||||
|
||||
'menu-rename' => 'Umbenennen',
|
||||
|
|
@ -64,11 +64,19 @@ return [
|
|||
'error-cannotnewdirectory' => 'Sie sind nicht berechtigt, neue Ordner zu erstellen',
|
||||
'error-cannotrename' => 'Sie sind nicht berechtigt, Ordner / Dateien umzubenennen',
|
||||
'error-cannotresize' => 'Sie sind nicht berechtigt, die Dateigröße zu ändern',
|
||||
'error-folder-not-found'=> 'Folder not found! (:folder)',
|
||||
'error-folder-not-found' => 'Folder not found! (:folder)',
|
||||
'error-size' => 'Over limit size:',
|
||||
'error-move-exist' => 'Datei existiert bereits.',
|
||||
'error-move-same' => 'Datei und Ziel sind gleich.',
|
||||
'error-move-parent' => 'Unterordner kann nicht verschoben werden.',
|
||||
'error-upload-1' => 'Die Datei überschreitet die in der PHP-Konfiguration (upload_max_filesize) festgelegte maximale Größe.',
|
||||
'error-upload-2' => 'Die Datei überschreitet die im HTML-Formular (MAX_FILE_SIZE) festgelegte maximale Größe.',
|
||||
'error-upload-3' => 'Die Datei wurde nur teilweise hochgeladen.',
|
||||
'error-upload-4' => 'Es wurde keine Datei hochgeladen.',
|
||||
'error-upload-6' => 'Es fehlt ein temporärer Ordner auf dem Server.',
|
||||
'error-upload-7' => 'Fehler beim Schreiben der Datei auf die Festplatte.',
|
||||
'error-upload-8' => 'Eine PHP-Erweiterung hat den Upload gestoppt.',
|
||||
'error-upload-unknown' => 'Ein unbekannter Upload-Fehler ist aufgetreten (Error Code: :code).',
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,290 +1,408 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
|
||||
<!-- Chrome, Firefox OS and Opera -->
|
||||
<meta name="theme-color" content="#333844">
|
||||
<!-- Windows Phone -->
|
||||
<meta name="msapplication-navbutton-color" content="#333844">
|
||||
<!-- iOS Safari -->
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="#333844">
|
||||
<!-- Chrome, Firefox OS and Opera -->
|
||||
<meta name="theme-color" content="#333844">
|
||||
<!-- Windows Phone -->
|
||||
<meta name="msapplication-navbutton-color" content="#333844">
|
||||
<!-- iOS Safari -->
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="#333844">
|
||||
|
||||
<title>{{ trans('laravel-filemanager::lfm.title-page') }}</title>
|
||||
<link rel="shortcut icon" type="image/png" href="{{ asset('vendor/laravel-filemanager/img/72px color.png') }}">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css">
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.css">
|
||||
<link rel="stylesheet" href="{{ asset('vendor/laravel-filemanager/css/cropper.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('vendor/laravel-filemanager/css/dropzone.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('vendor/laravel-filemanager/css/mime-icons.min.css') }}">
|
||||
<style>{!! \File::get(base_path('vendor/iqcontent/laravel-filemanager/public/css/lfm.css')) !!}</style>
|
||||
{{-- Use the line below instead of the above if you need to cache the css. --}}
|
||||
{{-- <link rel="stylesheet" href="{{ asset('/vendor/laravel-filemanager/css/lfm.css') }}"> --}}
|
||||
<title>{{ trans('laravel-filemanager::lfm.title-page') }}</title>
|
||||
<link rel="shortcut icon" type="image/png" href="{{ asset('vendor/laravel-filemanager/img/72px color.png') }}">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.5.0/css/all.css">
|
||||
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.css">
|
||||
<link rel="stylesheet" href="{{ asset('vendor/laravel-filemanager/css/cropper.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('vendor/laravel-filemanager/css/dropzone.min.css') }}">
|
||||
<link rel="stylesheet" href="{{ asset('vendor/laravel-filemanager/css/mime-icons.min.css') }}">
|
||||
<style>
|
||||
{!! \File::get(base_path('vendor/iqcontent/laravel-filemanager/public/css/lfm.css')) !!}
|
||||
</style>
|
||||
{{-- Use the line below instead of the above if you need to cache the css. --}}
|
||||
{{-- <link rel="stylesheet" href="{{ asset('/vendor/laravel-filemanager/css/lfm.css') }}"> --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<nav class="navbar sticky-top navbar-expand-lg navbar-dark" id="nav">
|
||||
<a class="navbar-brand invisible-lg d-none d-lg-inline" id="to-previous">
|
||||
<i class="fas fa-arrow-left fa-fw"></i>
|
||||
<span class="d-none d-lg-inline">{{ trans('laravel-filemanager::lfm.nav-back') }}</span>
|
||||
</a>
|
||||
<a class="navbar-brand d-block d-lg-none" id="show_tree">
|
||||
<i class="fas fa-bars fa-fw"></i>
|
||||
</a>
|
||||
<a class="navbar-brand d-block d-lg-none" id="current_folder"></a>
|
||||
<a id="loading" class="navbar-brand"><i class="fas fa-spinner fa-spin"></i></a>
|
||||
<div class="ml-auto px-2">
|
||||
<a class="navbar-link d-none" id="multi_selection_toggle">
|
||||
<i class="fa fa-check-double fa-fw"></i>
|
||||
<span class="d-none d-lg-inline">{{ trans('laravel-filemanager::lfm.menu-multiple') }}</span>
|
||||
</a>
|
||||
</div>
|
||||
<a class="navbar-toggler collapsed border-0 px-1 py-2 m-0" data-toggle="collapse" data-target="#nav-buttons">
|
||||
<i class="fas fa-cog fa-fw"></i>
|
||||
</a>
|
||||
<div class="collapse navbar-collapse flex-grow-0" id="nav-buttons">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-display="grid">
|
||||
<i class="fas fa-th-large fa-fw"></i>
|
||||
<span>{{ trans('laravel-filemanager::lfm.nav-thumbnails') }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-display="list">
|
||||
<i class="fas fa-list-ul fa-fw"></i>
|
||||
<span>{{ trans('laravel-filemanager::lfm.nav-list') }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">
|
||||
<i class="fas fa-sort fa-fw"></i>{{ trans('laravel-filemanager::lfm.nav-sort') }}
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right border-0"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<nav class="bg-light fixed-bottom border-top d-none" id="actions">
|
||||
<a data-action="open" data-multiple="false"><i class="fas fa-folder-open"></i>{{ trans('laravel-filemanager::lfm.btn-open') }}</a>
|
||||
<a data-action="preview" data-multiple="true"><i class="fas fa-images"></i>{{ trans('laravel-filemanager::lfm.menu-view') }}</a>
|
||||
<a data-action="use" data-multiple="true"><i class="fas fa-check"></i>{{ trans('laravel-filemanager::lfm.btn-confirm') }}</a>
|
||||
</nav>
|
||||
|
||||
<div class="d-flex flex-row">
|
||||
<div id="tree"></div>
|
||||
|
||||
<div id="main">
|
||||
<div id="alerts"></div>
|
||||
|
||||
<nav aria-label="breadcrumb" class="d-none d-lg-block" id="breadcrumbs">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item invisible">Home</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div id="empty" class="d-none">
|
||||
<i class="fa fa-folder-open"></i>
|
||||
{{ trans('laravel-filemanager::lfm.message-empty') }}
|
||||
</div>
|
||||
|
||||
<div id="content"></div>
|
||||
|
||||
<a id="item-template" class="d-none">
|
||||
<div class="square"></div>
|
||||
|
||||
<div class="info">
|
||||
<div class="item_name text-truncate"></div>
|
||||
<time class="text-muted font-weight-light text-truncate"></time>
|
||||
<nav class="navbar sticky-top navbar-expand-lg navbar-dark" id="nav">
|
||||
<a class="navbar-brand invisible-lg d-none d-lg-inline" id="to-previous">
|
||||
<i class="fas fa-arrow-left fa-fw"></i>
|
||||
<span class="d-none d-lg-inline">{{ trans('laravel-filemanager::lfm.nav-back') }}</span>
|
||||
</a>
|
||||
<a class="navbar-brand d-block d-lg-none" id="show_tree">
|
||||
<i class="fas fa-bars fa-fw"></i>
|
||||
</a>
|
||||
<a class="navbar-brand d-block d-lg-none" id="current_folder"></a>
|
||||
<a id="loading" class="navbar-brand"><i class="fas fa-spinner fa-spin"></i></a>
|
||||
<div class="ml-auto px-2">
|
||||
<a class="navbar-link d-none" id="multi_selection_toggle">
|
||||
<i class="fa fa-check-double fa-fw"></i>
|
||||
<span class="d-none d-lg-inline">{{ trans('laravel-filemanager::lfm.menu-multiple') }}</span>
|
||||
</a>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="fab"></div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myModalLabel">{{ trans('laravel-filemanager::lfm.title-upload') }}</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aia-hidden="true">×</span></button>
|
||||
<a class="navbar-toggler collapsed border-0 px-1 py-2 m-0" data-toggle="collapse" data-target="#nav-buttons">
|
||||
<i class="fas fa-cog fa-fw"></i>
|
||||
</a>
|
||||
<div class="collapse navbar-collapse flex-grow-0" id="nav-buttons">
|
||||
<ul class="navbar-nav">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-display="grid">
|
||||
<i class="fas fa-th-large fa-fw"></i>
|
||||
<span>{{ trans('laravel-filemanager::lfm.nav-thumbnails') }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-display="list">
|
||||
<i class="fas fa-list-ul fa-fw"></i>
|
||||
<span>{{ trans('laravel-filemanager::lfm.nav-list') }}</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item dropdown">
|
||||
<a class="nav-link dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true"
|
||||
aria-expanded="false">
|
||||
<i class="fas fa-sort fa-fw"></i>{{ trans('laravel-filemanager::lfm.nav-sort') }}
|
||||
</a>
|
||||
<div class="dropdown-menu dropdown-menu-right border-0"></div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{ route('iqcontent.lfm.upload') }}" role='form' id='uploadForm' name='uploadForm' method='post' enctype='multipart/form-data' class="dropzone">
|
||||
<div class="form-group" id="attachment">
|
||||
<div class="controls text-center">
|
||||
<div class="input-group w-100">
|
||||
<a class="btn btn-primary w-100 text-white" id="upload-button">{{ trans('laravel-filemanager::lfm.message-choose') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<nav class="bg-light fixed-bottom border-top d-none" id="actions">
|
||||
<a data-action="open" data-multiple="false"><i
|
||||
class="fas fa-folder-open"></i>{{ trans('laravel-filemanager::lfm.btn-open') }}</a>
|
||||
<a data-action="preview" data-multiple="true"><i
|
||||
class="fas fa-images"></i>{{ trans('laravel-filemanager::lfm.menu-view') }}</a>
|
||||
<a data-action="use" data-multiple="true"><i
|
||||
class="fas fa-check"></i>{{ trans('laravel-filemanager::lfm.btn-confirm') }}</a>
|
||||
</nav>
|
||||
|
||||
<div class="d-flex flex-row">
|
||||
<div id="tree"></div>
|
||||
|
||||
<div id="main">
|
||||
<div id="alerts"></div>
|
||||
|
||||
<nav aria-label="breadcrumb" class="d-none d-lg-block" id="breadcrumbs">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item invisible">Home</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div id="empty" class="d-none">
|
||||
<i class="fa fa-folder-open"></i>
|
||||
{{ trans('laravel-filemanager::lfm.message-empty') }}
|
||||
</div>
|
||||
<input type='hidden' name='working_dir' id='working_dir'>
|
||||
<input type='hidden' name='type' id='type' value='{{ request("type") }}'>
|
||||
<input type='hidden' name='_token' value='{{csrf_token()}}'>
|
||||
</form>
|
||||
|
||||
<div id="content"></div>
|
||||
|
||||
<a id="item-template" class="d-none">
|
||||
<div class="square"></div>
|
||||
|
||||
<div class="info">
|
||||
<div class="item_name text-truncate"></div>
|
||||
<time class="text-muted font-weight-light text-truncate"></time>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary w-100" data-dismiss="modal">{{ trans('laravel-filemanager::lfm.btn-close') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="fab"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="notify" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body"></div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary w-100" data-dismiss="modal">{{ trans('laravel-filemanager::lfm.btn-close') }}</button>
|
||||
<button type="button" class="btn btn-primary w-100" data-dismiss="modal">{{ trans('laravel-filemanager::lfm.btn-confirm') }}</button>
|
||||
<div class="modal fade" id="uploadModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
|
||||
aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title" id="myModalLabel">{{ trans('laravel-filemanager::lfm.title-upload') }}
|
||||
</h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
|
||||
aia-hidden="true">×</span></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="{{ route('iqcontent.lfm.upload') }}" role='form' id='uploadForm'
|
||||
name='uploadForm' method='post' enctype='multipart/form-data' class="dropzone">
|
||||
<div class="form-group" id="attachment">
|
||||
<div class="controls text-center">
|
||||
<div class="input-group w-100">
|
||||
<a class="btn btn-primary w-100 text-white"
|
||||
id="upload-button">{{ trans('laravel-filemanager::lfm.message-choose') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input type='hidden' name='working_dir' id='working_dir'>
|
||||
<input type='hidden' name='type' id='type' value='{{ request('type') }}'>
|
||||
<input type='hidden' name='_token' value='{{ csrf_token() }}'>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary w-100"
|
||||
data-dismiss="modal">{{ trans('laravel-filemanager::lfm.btn-close') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title"></h4>
|
||||
<div class="modal fade" id="notify" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-body"></div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary w-100"
|
||||
data-dismiss="modal">{{ trans('laravel-filemanager::lfm.btn-close') }}</button>
|
||||
<button type="button" class="btn btn-primary w-100"
|
||||
data-dismiss="modal">{{ trans('laravel-filemanager::lfm.btn-confirm') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="text" class="form-control">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary w-100" data-dismiss="modal">{{ trans('laravel-filemanager::lfm.btn-close') }}</button>
|
||||
<button type="button" class="btn btn-primary w-100" data-dismiss="modal">{{ trans('laravel-filemanager::lfm.btn-confirm') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="carouselTemplate" class="d-none carousel slide bg-light" data-ride="carousel">
|
||||
<ol class="carousel-indicators">
|
||||
<li data-target="#previewCarousel" data-slide-to="0" class="active"></li>
|
||||
</ol>
|
||||
<div class="carousel-inner">
|
||||
<div class="carousel-item active">
|
||||
<a class="carousel-label"></a>
|
||||
<div class="carousel-image"></div>
|
||||
</div>
|
||||
<div class="modal fade" id="dialog" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title"></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="text" class="form-control">
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary w-100"
|
||||
data-dismiss="modal">{{ trans('laravel-filemanager::lfm.btn-close') }}</button>
|
||||
<button type="button" class="btn btn-primary w-100"
|
||||
data-dismiss="modal">{{ trans('laravel-filemanager::lfm.btn-confirm') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<a class="carousel-control-prev" href="#previewCarousel" role="button" data-slide="prev">
|
||||
<div class="carousel-control-background" aria-hidden="true">
|
||||
<i class="fas fa-chevron-left"></i>
|
||||
</div>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
<a class="carousel-control-next" href="#previewCarousel" role="button" data-slide="next">
|
||||
<div class="carousel-control-background" aria-hidden="true">
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
</div>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
|
||||
<script src="{{ asset('vendor/laravel-filemanager/js/cropper.min.js') }}"></script>
|
||||
<script src="{{ asset('vendor/laravel-filemanager/js/dropzone.min.js') }}"></script>
|
||||
<script>
|
||||
var lang = {!! json_encode(trans('laravel-filemanager::lfm')) !!};
|
||||
var actions = [
|
||||
// {
|
||||
// name: 'use',
|
||||
// icon: 'check',
|
||||
// label: 'Confirm',
|
||||
// multiple: true
|
||||
// },
|
||||
{
|
||||
name: 'rename',
|
||||
icon: 'edit',
|
||||
label: lfm_lang['menu-rename'],
|
||||
multiple: false
|
||||
},
|
||||
{
|
||||
name: 'download',
|
||||
icon: 'download',
|
||||
label: lfm_lang['menu-download'],
|
||||
multiple: true
|
||||
},
|
||||
// {
|
||||
// name: 'preview',
|
||||
// icon: 'image',
|
||||
// label: lfm_lang['menu-view'],
|
||||
// multiple: true
|
||||
// },
|
||||
{
|
||||
name: 'move',
|
||||
icon: 'paste',
|
||||
label: lfm_lang['menu-move'],
|
||||
multiple: true
|
||||
},
|
||||
{
|
||||
name: 'resize',
|
||||
icon: 'arrows-alt',
|
||||
label: lfm_lang['menu-resize'],
|
||||
multiple: false
|
||||
},
|
||||
{
|
||||
name: 'crop',
|
||||
icon: 'crop',
|
||||
label: lfm_lang['menu-crop'],
|
||||
multiple: false
|
||||
},
|
||||
{
|
||||
name: 'trash',
|
||||
icon: 'trash',
|
||||
label: lfm_lang['menu-delete'],
|
||||
multiple: true
|
||||
},
|
||||
];
|
||||
<div id="carouselTemplate" class="d-none carousel slide bg-light" data-ride="carousel">
|
||||
<ol class="carousel-indicators">
|
||||
<li data-target="#previewCarousel" data-slide-to="0" class="active"></li>
|
||||
</ol>
|
||||
<div class="carousel-inner">
|
||||
<div class="carousel-item active">
|
||||
<a class="carousel-label"></a>
|
||||
<div class="carousel-image"></div>
|
||||
</div>
|
||||
</div>
|
||||
<a class="carousel-control-prev" href="#previewCarousel" role="button" data-slide="prev">
|
||||
<div class="carousel-control-background" aria-hidden="true">
|
||||
<i class="fas fa-chevron-left"></i>
|
||||
</div>
|
||||
<span class="sr-only">Previous</span>
|
||||
</a>
|
||||
<a class="carousel-control-next" href="#previewCarousel" role="button" data-slide="next">
|
||||
<div class="carousel-control-background" aria-hidden="true">
|
||||
<i class="fas fa-chevron-right"></i>
|
||||
</div>
|
||||
<span class="sr-only">Next</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
var sortings = [
|
||||
{
|
||||
by: 'alphabetic',
|
||||
icon: 'sort-alpha-down',
|
||||
label: lfm_lang['nav-sort-alphabetic']
|
||||
},
|
||||
{
|
||||
by: 'time',
|
||||
icon: 'sort-numeric-down',
|
||||
label: lfm_lang['nav-sort-time']
|
||||
}
|
||||
];
|
||||
</script>
|
||||
<script>{!! \File::get(base_path('vendor/iqcontent/laravel-filemanager/public/js/script.js')) !!}</script>
|
||||
{{-- Use the line below instead of the above if you need to cache the script. --}}
|
||||
{{-- <script src="{{ asset('vendor/laravel-filemanager/js/script.js') }}"></script> --}}
|
||||
<script>
|
||||
Dropzone.options.uploadForm = {
|
||||
paramName: "upload[]", // The name that will be used to transfer the file
|
||||
uploadMultiple: false,
|
||||
parallelUploads: 5,
|
||||
clickable: '#upload-button',
|
||||
dictDefaultMessage: '<i class="ion ion-ios-cloud-upload "></i>'+lfm_lang['message-drop'],
|
||||
init: function() {
|
||||
var _this = this; // For the closure
|
||||
this.on('success', function(file, response) {
|
||||
if (response == 'OK') {
|
||||
loadFolders();
|
||||
} else {
|
||||
this.defaultOptions.error(file, response.join('\n'));
|
||||
}
|
||||
});
|
||||
},
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + getUrlParam('token')
|
||||
},
|
||||
acceptedFiles: "{{ implode(',', $helper->availableMimeTypes()) }}",
|
||||
maxFilesize: ({{ $helper->maxUploadSize() }} / 1000)
|
||||
}
|
||||
</script>
|
||||
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"></script>
|
||||
<script src="{{ asset('vendor/laravel-filemanager/js/cropper.min.js') }}"></script>
|
||||
<script src="{{ asset('vendor/laravel-filemanager/js/dropzone.min.js') }}"></script>
|
||||
<script>
|
||||
var lang = {!! json_encode(trans('laravel-filemanager::lfm')) !!};
|
||||
var actions = [
|
||||
// {
|
||||
// name: 'use',
|
||||
// icon: 'check',
|
||||
// label: 'Confirm',
|
||||
// multiple: true
|
||||
// },
|
||||
{
|
||||
name: 'rename',
|
||||
icon: 'edit',
|
||||
label: lfm_lang['menu-rename'],
|
||||
multiple: false
|
||||
},
|
||||
{
|
||||
name: 'download',
|
||||
icon: 'download',
|
||||
label: lfm_lang['menu-download'],
|
||||
multiple: true
|
||||
},
|
||||
// {
|
||||
// name: 'preview',
|
||||
// icon: 'image',
|
||||
// label: lfm_lang['menu-view'],
|
||||
// multiple: true
|
||||
// },
|
||||
{
|
||||
name: 'move',
|
||||
icon: 'paste',
|
||||
label: lfm_lang['menu-move'],
|
||||
multiple: true
|
||||
},
|
||||
{
|
||||
name: 'resize',
|
||||
icon: 'arrows-alt',
|
||||
label: lfm_lang['menu-resize'],
|
||||
multiple: false
|
||||
},
|
||||
{
|
||||
name: 'crop',
|
||||
icon: 'crop',
|
||||
label: lfm_lang['menu-crop'],
|
||||
multiple: false
|
||||
},
|
||||
{
|
||||
name: 'trash',
|
||||
icon: 'trash',
|
||||
label: lfm_lang['menu-delete'],
|
||||
multiple: true
|
||||
},
|
||||
];
|
||||
|
||||
var sortings = [{
|
||||
by: 'alphabetic',
|
||||
icon: 'sort-alpha-down',
|
||||
label: lfm_lang['nav-sort-alphabetic']
|
||||
},
|
||||
{
|
||||
by: 'time',
|
||||
icon: 'sort-numeric-down',
|
||||
label: lfm_lang['nav-sort-time']
|
||||
}
|
||||
];
|
||||
</script>
|
||||
<script>
|
||||
{!! \File::get(base_path('vendor/iqcontent/laravel-filemanager/public/js/script.js')) !!}
|
||||
</script>
|
||||
{{-- Use the line below instead of the above if you need to cache the script. --}}
|
||||
{{-- <script src="{{ asset('vendor/laravel-filemanager/js/script.js') }}"></script> --}}
|
||||
<script>
|
||||
Dropzone.options.uploadForm = {
|
||||
paramName: "upload[]", // The name that will be used to transfer the file
|
||||
uploadMultiple: false,
|
||||
parallelUploads: 5,
|
||||
clickable: '#upload-button',
|
||||
dictDefaultMessage: '<i class="ion ion-ios-cloud-upload "></i>' + lfm_lang['message-drop'],
|
||||
init: function() {
|
||||
var _this = this; // For the closure
|
||||
this.on('success', function(file, response) {
|
||||
// Prüfe, ob die Antwort einen Fehler enthält
|
||||
if (response && response.error) {
|
||||
// Fehler in der erfolgreichen Antwort (sollte nicht passieren, aber zur Sicherheit)
|
||||
_this.emit('error', file, response);
|
||||
} else if (response == 'OK' || (response && response.url)) {
|
||||
// Erfolgreicher Upload
|
||||
loadFolders();
|
||||
|
||||
// Entferne die Datei nach kurzer Verzögerung
|
||||
setTimeout(function() {
|
||||
_this.removeFile(file);
|
||||
}, 2000);
|
||||
} else if (Array.isArray(response)) {
|
||||
// Alte Array-Antwort (sollte nicht mehr vorkommen)
|
||||
_this.emit('error', file, response.join('\n'));
|
||||
}
|
||||
});
|
||||
|
||||
this.on('error', function(file, errorMessage, xhr) {
|
||||
var message = errorMessage;
|
||||
|
||||
console.log('Dropzone Error Event:', {
|
||||
file: file.name,
|
||||
fileSize: file.size,
|
||||
errorMessage: errorMessage,
|
||||
xhr: xhr,
|
||||
xhrStatus: xhr ? xhr.status : 'no xhr',
|
||||
xhrResponse: xhr ? xhr.responseText : 'no response'
|
||||
});
|
||||
|
||||
// Behandle HTTP-Fehler-Responses
|
||||
if (xhr && xhr.status !== 200) {
|
||||
if (xhr.status === 413) {
|
||||
message =
|
||||
'Die Datei ist zu groß!\n\n' +
|
||||
'Der Server lehnt den Upload ab (HTTP 413 - Payload Too Large).\n\n' +
|
||||
'Aktuelles Server-Limit für Uploads:\n' +
|
||||
'- Nginx client_max_body_size: zu klein\n' +
|
||||
'- Empfohlen: mindestens 50MB\n\n' +
|
||||
'Bitte kontaktieren Sie den Administrator, um das Upload-Limit zu erhöhen.\n\n' +
|
||||
'Dateigröße: ' + (file.size / 1024 / 1024).toFixed(2) + ' MB';
|
||||
} else if (xhr.status === 0) {
|
||||
message =
|
||||
'Upload fehlgeschlagen: Keine Verbindung zum Server.\n\n' +
|
||||
'Mögliche Ursachen:\n' +
|
||||
'- Die Datei ist zu groß für den Server\n' +
|
||||
'- Netzwerkverbindung unterbrochen\n' +
|
||||
'- Server antwortet nicht\n\n' +
|
||||
'Dateigröße: ' + (file.size / 1024 / 1024).toFixed(2) + ' MB';
|
||||
} else {
|
||||
// Versuche die Fehlermeldung aus der Response zu extrahieren
|
||||
try {
|
||||
var response = JSON.parse(xhr.responseText);
|
||||
if (response && response.error && response.error.message) {
|
||||
message = response.error.message;
|
||||
} else if (response && response.message && response.message.trim() !== '') {
|
||||
message = response.message;
|
||||
} else {
|
||||
message = 'Server-Fehler (' + xhr.status + '): ' + xhr.statusText;
|
||||
}
|
||||
} catch (e) {
|
||||
message = 'Server-Fehler (' + xhr.status + '): ' + (xhr.statusText ||
|
||||
'Unbekannter Fehler');
|
||||
}
|
||||
}
|
||||
}
|
||||
// Wenn errorMessage ein Object ist, extrahiere die eigentliche Fehlermeldung
|
||||
else if (typeof errorMessage === 'object' && errorMessage !== null) {
|
||||
if (errorMessage.error && errorMessage.error.message) {
|
||||
// Backend-Fehlerformat: {error: {message: "..."}}
|
||||
message = errorMessage.error.message;
|
||||
} else if (errorMessage.message) {
|
||||
// Alternatives Format: {message: "..."}
|
||||
message = errorMessage.message;
|
||||
} else if (Array.isArray(errorMessage) && errorMessage.length > 0) {
|
||||
// Array von Fehlern
|
||||
message = errorMessage.join('\n');
|
||||
} else {
|
||||
// Fallback: JSON-String mit besserem Format
|
||||
try {
|
||||
message = 'Fehler: ' + JSON.stringify(errorMessage, null, 2);
|
||||
} catch (e) {
|
||||
message = 'Ein unbekannter Fehler ist aufgetreten.';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Aktualisiere die Fehlermeldung im Dropzone-Element
|
||||
if (file.previewElement) {
|
||||
var errorNode = file.previewElement.querySelector('[data-dz-errormessage]');
|
||||
if (errorNode) {
|
||||
errorNode.textContent = message;
|
||||
}
|
||||
}
|
||||
|
||||
// Zeige auch ein Alert
|
||||
alert('Upload-Fehler: ' + message);
|
||||
|
||||
console.error('Upload-Fehler (verarbeitet):', {
|
||||
file: file.name,
|
||||
message: message,
|
||||
originalError: errorMessage
|
||||
});
|
||||
});
|
||||
},
|
||||
headers: {
|
||||
'Authorization': 'Bearer ' + getUrlParam('token')
|
||||
},
|
||||
acceptedFiles: "{{ implode(',', $helper->availableMimeTypes()) }}",
|
||||
maxFilesize: ({{ $helper->maxUploadSize() }} / 1000)
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue