1. Go to this page and download the library: Download fboseca/files_manager library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fboseca / files_manager example snippets
php artisan vendor:publish
php artisan migrate
php php artisan storage:link
Route::get('custom/files/{has}', function ($has) {
return \Redirect::route('file.manager.private', $has);
});
$file = $user->files()->find(1);
$file->delete();
//in your controller
return $file->download();
return $file->download('name-of-file');
//in your view
<a href="{{$file->downloadSrc}}">download</a> //only for public files
<a href="{{$file->forceDownloadSrc}}">download</a> //for all public and privates files
Route::get('you/route/{has}', function ($has) {
return \Redirect::route('download.file', $has);
})->name('{yourNameOfRoute}');
class User extends Authenticatable {
use Notifiable, HasFiles;
public function fileCustomVariables() {
$this->FILE_FOLDER_DEFAULT = "/users/$this->id/documents";
$this->FILE_DISK_DEFAULT = 's3';
}
}
//change the disk and folder for user
$user->disk('s3')->folder("/users/$user->id/documents");
$user->addFile( $request->file('otherFile')); //saved in disk s3 and folder user/1/documents
$user->addFile( $request->file('otherFile'),[
"folder" => 'copies',
"disk" => "private"
]); //saved in disk private and folder copies
$user->addFile( $request->file('otherFile')); //saved in disk s3 and folder user/1/documents
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.