Laravel UniSharp文件管理器无效的上传请求

hmtdttj4  于 2023-05-08  发布在  其他
关注(0)|答案(2)|浏览(119)

有人知道如何为本地项目设置嵌入式unsharp文件管理器吗?目前,我总是得到这个错误消息“无效的上传请求”:

这就是代码:查看

<iframe src="/laravel-filemanager?type=Images" style="width: 100%; height: 500px; overflow: hidden; border: none;"></iframe>

这是config/lfm.php:

'folder_categories'        => [
    'file'  => [
        'folder_name'  => 'files',
        'startup_view' => 'list',
        'max_size'     => 50000, // size in KB
        'thumb' => true,
        'thumb_width' => 80,
        'thumb_height' => 80,
        'valid_mime'   => [
            'image/txt',
            'image/pdf',
        ],
    ],
    'image' => [
        'folder_name'  => 'photos',
        'startup_view' => 'grid',
        'max_size'     => 50000, // size in KB
        'thumb' => true,
        'thumb_width' => 80,
        'thumb_height' => 80,
        'valid_mime'   => [
            'image/jpeg',
            'image/pjpeg',
            'image/png',
            'image/gif',
            'image/jpg',
            'image/svg',
        ],
    ],
],

**注意:**我已经找到了导致此问题的原因,它是:

// If true, image thumbnails would be created during upload
'should_create_thumbnails' => true,

If I set this to **false** images are uploaded but without the thumbnails. Any ideas on how to solve this issue?

**Here is latest log**:

    [2022-06-21 07:44:34] laravel.EMERGENCY: Unable to create configured logger. Using emergency logger. {"exception":"[object] (InvalidArgumentException(code: 0): Log [deprecations] is not defined. at C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Log\\LogManager.php:207)
[stacktrace]
#0 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Log\\LogManager.php(132): Illuminate\\Log\\LogManager->resolve('deprecations', NULL)
#1 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Log\\LogManager.php(119): Illuminate\\Log\\LogManager->get('deprecations')
#2 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Log\\LogManager.php(108): Illuminate\\Log\\LogManager->driver('deprecations')
#3 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\HandleExceptions.php(122): Illuminate\\Log\\LogManager->channel('deprecations')
#4 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\HandleExceptions.php(71): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleDeprecationError('mb_detect_encod...', 'C:\\\\xampp\\\\htdocs...', 237, 8192)
#5 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\HandleExceptions.php(255): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(8192, 'mb_detect_encod...', 'C:\\\\xampp\\\\htdocs...', 237)
#6 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}(8192, 'mb_detect_encod...', 'C:\\\\xampp\\\\htdocs...', 237)
#7 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\unisharp\\laravel-filemanager\\src\\Lfm.php(237): mb_detect_encoding(NULL)
#8 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\unisharp\\laravel-filemanager\\src\\Lfm.php(33): UniSharp\\LaravelFilemanager\\Lfm->translateFromUtf8(NULL)
#9 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\unisharp\\laravel-filemanager\\src\\Lfm.php(92): UniSharp\\LaravelFilemanager\\Lfm->input('type')
#10 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\unisharp\\laravel-filemanager\\src\\Lfm.php(198): UniSharp\\LaravelFilemanager\\Lfm->currentLfmType()
#11 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\unisharp\\laravel-filemanager\\src\\Lfm.php(70): UniSharp\\LaravelFilemanager\\Lfm->allowMultiUser()
#12 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\unisharp\\laravel-filemanager\\src\\Middlewares\\CreateDefaultFolder.php(30): UniSharp\\LaravelFilemanager\\Lfm->allowFolderType('user')
#13 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\unisharp\\laravel-filemanager\\src\\Middlewares\\CreateDefaultFolder.php(22): UniSharp\\LaravelFilemanager\\Middlewares\\CreateDefaultFolder->checkDefaultFolderExists('user')
#14 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): UniSharp\\LaravelFilemanager\\Middlewares\\CreateDefaultFolder->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#15 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php(50): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#16 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#17 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php(78): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#18 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#19 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#20 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#21 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(121): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#22 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(64): Illuminate\\Session\\Middleware\\StartSession->handleStatefulRequest(Object(Illuminate\\Http\\Request), Object(Illuminate\\Session\\Store), Object(Closure))
#23 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#24 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php(37): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#25 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#26 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php(67): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#27 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#28 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#29 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(726): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#30 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(703): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#31 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(667): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#32 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(656): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#33 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(167): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#34 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(141): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#35 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#36 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull.php(31): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#37 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ConvertEmptyStringsToNull->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#38 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(21): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#39 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TrimStrings.php(40): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#40 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\TrimStrings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#41 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php(27): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#42 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#43 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance.php(86): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#44 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Foundation\\Http\\Middleware\\PreventRequestsDuringMaintenance->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#45 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\HandleCors.php(49): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#46 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\HandleCors->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Http\\Middleware\\TrustProxies.php(39): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#48 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(180): Illuminate\\Http\\Middleware\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#49 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(116): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#50 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(142): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#51 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(111): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#52 C:\\xampp\\htdocs\\laravel-projekti\\media\\public\\index.php(52): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#53 C:\\xampp\\htdocs\\laravel-projekti\\media\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\
esources\\server.php(16): require_once('C:\\\\xampp\\\\htdocs...')
#54 {main}
"}

当上面的值为true时,我也会得到错误:

在屏幕的顶部,我有这样的消息:

Please install gd or imagick extension to crop, resize, and make thumbnails of images.

即使我已经安装了gd

h43kikqp

h43kikqp1#

unsharp使用intervention/image创建缩略图,并默认将其放在storage/app/public/中,因此可能存在2个潜在问题:
1.缺少PHP扩展(gdimagick
1.如果您尚未将存储链接到public,则缩略图无法在客户端显示,您可以运行php artisan storage:link来创建符号链接

oyjwcjzk

oyjwcjzk2#

取消注解

;extension=gd2

和/或

;extension=exif

从您的php.ini文件
然后删除公共/存储文件运行

php artisan storage:link

解决了我的问题

相关问题