Official:
https://unisharp.github.io/laravel-filemanager/installation
Notes for installation:
- composer require unisharp/laravel-filemanager:~1.8
This command is must - Under 5.5 need to add service providers and then execute vender:publish commands.
- <script src=”/vendor/laravel-filemanager/js/lfm.js”></script>
Javascript name in DOC is wrong. - Remove “auth” middleware from /config/lfm.php if don’t need auth.
- If don’t use auth, override function in /vendor/…/Handlers/ConfigHandler to return static number. e.g. 1
\vendor\unisharp\laravel-filemanager\src\Handlers\ConfigHandler.php - Make sure extension “mbstring” and “exif” is enabled in php.ini
To debug uploading process:
\vendor\unisharp\laravel-filemanager\src\controllers\UploadController.php
HTML Example:
1 2 3 4 5 6 7 8 9 |
<div class="input-group"> <span class="input-group-btn"> <a id="lfm" data-input="thumbnail" data-preview="holder" class="btn btn-primary"> <i class="fa fa-picture-o"></i> Choose </a> </span> <input id="thumbnail" class="form-control" type="text" name="logo_icon" value="{{$p_data->logo_icon}}"> </div> <img id="holder" style="margin-top:15px;max-height:100px;"> |
Helper to get thumb:
1 2 3 4 5 6 |
if(!function_exists('lfm_thumb')){ function lfm_thumb($file){ $dir = dirname($file); return $dir . '/thumbs/' . basename($file); } } |
Note:
- Language:
Just change language code in configs/app.php. e.g. zh-TW
Supported language files:
\vendor\unisharp\laravel-filemanager\src\lang\ - Main view of File Manager is “\vendor\unisharp\laravel-filemanager\src\views\index.blade.php” and it uses some helpers of laravel like url(), asset(). If you use https only, these helpers will cause error. Try to overwrite Laravel helpers will solve these problems.
Path to laravel helper:
\vendor\laravel\framework\src\Illuminate\Foundation\helpers.php12345678910111213141516171819202122if (! function_exists('url')) {/*** Generate a url for the application.** @param string $path* @param mixed $parameters* @param bool $secure* @return \Illuminate\Contracts\Routing\UrlGenerator|string*/function url($path = null, $parameters = [], $secure = null){if (is_null($path)) {return app(UrlGenerator::class);}if(env('USE_HTTPS') == true){$secure = true;}return app(UrlGenerator::class)->to($path, $parameters, $secure);}}
Error: Invalid upload request
This error could result from function orientate() in Intervention\Image\Facades\Image.

Solution: Make sure enable EXIF in php.ini.
