laravelunisharp-file-manager

Laravel UniSharp file-manager Invalid upload request


does someone know how to set up an embedded unsharp file manager for the local project? Currently, I always get this error message "Invalid upload request":

enter image description here

This is the code: View

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

This is 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',
        ],
    ],
],

NOTE: I have found what caused this issue, it was:

// 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}
"} 

When above value is true I also get the error: enter image description here

And at the top of the screen I have this message:

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

even after I have installed gd


Solution

  • unsharp use intervention/image to create a thumbnail and put it inside storage/app/public/ by default, so there're maybe 2 potential problems:

    1. lack of PHP extension (gd or imagick)
    2. If you haven't linked to storage to public yet, the thumbnail can't show in the client, you can run php artisan storage:link to create a symlink