Downloads
Stars
Version
To manage storage access for s3 & local filesystem
# In your Laravel Project
$ composer require yuyu-tech/file-manager
# Publish package resourceses using
$ php artisan vendor:publish --provider="Yuyu\FileManager\Providers\FileManagerServiceProvider"
#To migrate package resources
$ php artisan migrate --path=database/migration/2019_10_24_090016_create_attachments_table.php
# For ease of use for local storage, create the symbolic link for storage directory using
# Not require for S3 storage
$ php artisan storage:link
We can generate instance of FileManagerController using below ways.
use FileManager;
$objFileManager = new FileManager;
use \Yuyu\FileManager\Controllers\FileManagerController;
$objFileManager = new FileManagerController;
$objFileManager = app('fileManager');
We can store eiter file content or UploadedFile object directly.
$objAttachment = FileManager::storeFile($request->file, $user, 'profilePicture', '/user/profile-picture/');
$objAttachment = FileManager::storeContent($content, $strFileName, $strMimeType, $strExtension, $user, 'profilePicture', $strPath='user/profile-picture');
// Generate a view URL for attachment id 1 which will expire after 50 Minutes.
$strViewUrl = FileManager::getAccessUrl(1, 'view', 50);
// Generate a download URL for attachment id 1 which will never expire
// Here to generate never expire URL we will pass a biggest value for expire after parameter.
$strViewUrl = FileManager::getAccessUrl(1, 'download', 99999999999);