unisharp/laravel-filemanager
UniSharp Laravel Filemanager adds a responsive web-based file manager to Laravel apps. Browse, upload, organize and delete files and images, integrate with editors like TinyMCE/CKEditor, configure disks, permissions, and customization options.
The config is in config/lfm.php.
booleantrueUse default routes or not. You will need to define routes to all controllers of this package if this is set to false.
booleantrueOnly the owner(each signed-in user) of the private can upload and manage files within. Set to false to turn this feature off.
stringPrivates folders for each user will be named by this config. Default to user id.
To change the behavior:
php artisan publish tag="lfm_handler"userField function in App\Handler\ConfigHandler classbooleantruestring"shares"Flexible way to customize client folders accessibility.
If you want to customize client folders:
php artisan publish tag="lfm_handler"userField function in App\Handler\ConfigHandler classApp\Handler\ConfigHandler::classAll users can upload and manage files within shared folders. Set to false to turn this feature off.
array (nested)'folder_categories' => [
'file' => [
'folder_name' => 'files',
'startup_view' => 'list',
'max_size' => 50000, // size in KB
'valid_mime' => [
'image/jpeg',
'image/pjpeg',
'image/png',
'image/gif',
'application/pdf',
'text/plain',
],
],
'image' => [
'folder_name' => 'photos',
'startup_view' => 'grid',
'max_size' => 50000, // size in KB
'valid_mime' => [
'image/jpeg',
'image/pjpeg',
'image/png',
'image/gif',
],
],
],
The default config creates two folder categories, file and image, each operates independently. Files uploaded by users will be placed under one of these folder categories, depend on which is configured with your WYSIWYG editor or stand-alone upload button.
Detail options are explained here:
folder_name: The folder name of the category. For example, if folder_name is set to files2 then:
/<path-to-laravel>/storage/app/public/files2/<user-id>//<path-to-laravel>/storage/app/public/files2/shares/startup_view: The default display mode. Available options: list & grid.max_size: The maximum size(in KB) of of a single file to be uploaded.valid_mime: Only files with mime types listed here are allowed to be uploaded. See full mime types list.array'paginator' => [
'perPage' => 30,
],
stringpublicDisk name of Laravel File System. All files are placed in here. Choose one of the disks section in config/filesystems.php.
int30Duration of AWS S3 temporary urls, in minutes.
booleanfalseEnable to support AWS S3 “Bucket owner enforced” (ACL-disabled) buckets.
booleanfalseIf set to true, the uploaded file will be renamed using uniqid().
booleanfalseIf set to true, non-alphanumeric file name will be replaced with _.
booleanfalseIf set to true, non-alphanumeric folder name will be rejected.
booleanfalseIf set to true, the size of uploading file will be verified.
booleantrueIf set to true, the mime type of uploading file will be verified.
intfalseDefine behavior on files with identical name. Setting it to true cause old file replace with new one. Setting it to false show error-file-exist error and abort the upload process.
booleantrueIf set to true, thumbnails will be created for faster loading.
stringthumbsFolder name to place thumbnails.
array'raster_mimetypes' => [
'image/jpeg',
'image/pjpeg',
'image/png',
],
Create thumbnails automatically only for listed types. See full mime types list.
int200Thumbnail images width (in px).
int200Thumbnail images height (in px).
Create thumbnails automatically only for listed types.
array'file_type_array' => [
'pdf' => 'Adobe Acrobat',
'doc' => 'Microsoft Word',
'docx' => 'Microsoft Word',
'xls' => 'Microsoft Excel',
'xlsx' => 'Microsoft Excel',
'zip' => 'Archive',
'gif' => 'GIF Image',
'jpg' => 'JPEG Image',
'jpeg' => 'JPEG Image',
'png' => 'PNG Image',
'ppt' => 'Microsoft PowerPoint',
'pptx' => 'Microsoft PowerPoint',
],
Gives description for listed file extensions.
array or boolean'php_ini_overrides' => [
'memory_limit' => '256M',
],
These values override your php.ini settings before uploading files. Set these to false to ingnore and apply your php.ini settings
⚠️ Caveats
The php_ini_overrides are applied on every request the filemanager does and are reset once the script has finished executing. This has one drawback: any ini settings that you might want to change that apply to the request itself will not work.
For example, overriding these settings will not work:
Why this is expected behaviour: upload_max_filesize and post_max_size will get set but uploaded files are already passed to your PHP script before the settings are changed.
How can I help you explore Laravel packages today?