Laravel File Manager Tutorial Example Step By Step

Laravel File Manager Example; In this tutorial you will learn how to install and use file manager package in laravel application. The UniSharp/laravel-filemanager package support multiple files selection, cloud storage integration and mutiple features as well. Lets see how to integrate laravel file manager tutorial with example step by step.

The Unisharp package has multiple feature just like below:

  • File upload and management
  • Uploading validation
  • Cropping and resizing of images
  • RWD user interface, and can be entirely customized
  • Supporting multiple files selection
  • Supporting cloud storages integration(with Laravel file system)
  • Multiple integration options:
    • WYSIWYG editors integration (CKEditor, TinyMCE, Summernote)
    • Standalone upload button
    • Iframe
  • Multi-user mode:
    • Shared folders: all users can upload and manage files
    • Private folders: dedicated folder for each user, only the owner can upload or manage files within
  • Customizable routes, middlewares, views, and folder path
  • Supports two categories: files and images. Each type works in different directory.
  • Supported locales : ar, az, bg, cs, de, el, en, es, eu, fa, fr, he, hu, id, it, ka, nl, pl, pt, pt-BR, ro, rs, ru, sk, sv, tr, uk, vi, zh-CN, zh-TW

Step 1: Install Laravel App

First, we need to create one fresh laravel application help of the composer command. just run the following command in your terminal and create one laravel application.

composer create-project --prefer-dist laravel/laravel laravel-app

Step 2: Configure Database Credentials

Now, into the second step, we should configure the database settings in .env file just open your .env file and make the following changes. set youe database name, username, and password.


Step 3: Install Unisharp Package

Next, install the filemanager package using the following command:

composer require unisharp/laravel-filemanager

Add providers and aliases in config app file, open app.php file and update provider and aliases.


'Image' => Intervention\Image\Facades\Image::class,

Now publish the package’s config and assets using bellow command:

php artisan vendor:publish --tag=lfm_config
php artisan vendor:publish --tag=lfm_public

Step 4: Add Route

Open the web.php routes file and update the below code on it.

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\FileManagerController;
| Web Routes
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
Route::get('filemanager', [FileManagerController::class, 'index']);

Step 5: Create Controller

Now create new controller as FileManagerController just running below command.

php artisan make:controller FileManagerController

After successfully created controller add below methods on it.


namespace App\Http\Controllers;
use Illuminate\Http\Request;
class FileManagerController extends Controller
     * Display a listing of the resource.
     * @return \Illuminate\Http\Response
    public function index(Request $request)
        return view('filemanager');

Step 6: Create Blade Files

Next, create blade files for filemanager. So, navigate resources/views and create filemanager.blade.php file. Now open the created resources/views/filemanager.blade.php file and put the following code;

<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- CSRF Token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <title>{{ config('', 'File Manager') }}</title>
    <!-- Styles -->
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="">
    <link href="{{ asset('vendor/file-manager/css/file-manager.css') }}" rel="stylesheet">
    <link href="">
    <div class="container">
        <h2>Laravel File Manager Tutorial Example - codingdriver.Com</h2>
        <div class="row">
            <div class="col-md-12" id="fm-main-block">
                <div id="fm"></div>
    <!-- File manager -->
    <script src="{{ asset('vendor/file-manager/js/file-manager.js') }}"></script>
      document.addEventListener('DOMContentLoaded', function() {
        document.getElementById('fm-main-block').setAttribute('style', 'height:' + window.innerHeight + 'px');
        fm.$store.commit('fm/setFileCallBack', function(fileUrl) {

Step 7: Run Development Server

php artisan serve

Next, hitt the below url in your browser


If you will get fileuploading error then generate symbolic link bellow command.

php artisan storage:link

I hope this code work for you.

Leave a Comment