Laravel 9 Dropzone Multiple File Upload Example

  • 13-02-2023
  • 1337
  • Laravel 9
  • Haresh Chauhan

Watch Youtube Video (HINDI) :

In this tutorial we will integrate dropzone multiple file uploads in laravel, Dropzone is a popular open-source library for handling drag-and-drop file uploads in web applications. In the Laravel framework, you can use Dropzone to handle file uploads by integrating it with your application's HTML and JavaScript. Here's an example of how you can use Dropzone in Laravel.

just by drag and drop you can easy to upload files using dropzone laravel, we will add the dropzone js library from the site and we will add a post method form for dragging and dropping files on specific spaces to get upload files on the server.

Preview :


Step 1. Create Project

In this step, we will create a new fresh laravel project, if you already installed skip this step and move forward to the next step.

Use the below command and create a Laravel application on your server.

composer create-project laravel/laravel laravel

After successfully installing the new laravel app, we will config the database connection with the MYSQL database, goto the .env file, and add your database credential to get connection your application with the database.


Step 2. Create Controller

In this step, we will create a controller, use the below command in your command prompt and create an "ImageZoneController" just by entering the below provided command.

php artisan make:controller ImageZoneController

After that, we will create a migration and model the create an image table in the database to save the file name which we uploaded. use the below command in your app command prompt and create.

php artisan make:model Image -m

Just do give tow methods as below given in the controller in your app, the first method for the view blade file, and the second method for the upload file to the server just dropping in dropzone areas in the web page.

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Models\Image; 
class ImageZoneController extends Controller
    public function show()
      return view('image');
    public function upload(Request $request) 
      $image = $request->file('file');
      $name = $request->file('file')->getClientOriginalName();
      $model = new Image();
      $model->image_name = $name;

      return response()->json(['success'=>$name]);

Step 3. Migration

Goto migration file, and paste up() method in your images migration file as below given.


use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateImagesTable extends Migration
     * Run the migrations.
     * @return void
    public function up()
      Schema::create('images', function (Blueprint $table) {

     * Reverse the migrations.
     * @return void
    public function down()

After adding the field "image_name" in the migration file, we will migrate the database by entering the below command in the command prompt.

php artisan migrate

Step 4. Create a view file

Create an "image.blade.php" file in the below path, First, you need to include the Dropzone library in your project. You can either download it from the Dropzone website and include it in your project or use a package manager such as NPM to install it.

After that, create an HTML form that will be used to display the file upload interface. The form should contain a div element with an id, which will be used to initialize the Dropzone instance.

<!DOCTYPE html>
    <title>Webappfix - Laravel 9 Multiple Upload Images using Dropzone drag and drop</title>
    <meta name="_token" content="{{csrf_token()}}" />
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="">
    <script src=""></script>
    <script src=""></script>
<div class="container">
    <p><h1>Webappfix - Laravel 9 Multiple Upload Images using Dropzone drag and drop</h1></p>
    <form method="post" action="{{url('image/upload')}}" enctype="multipart/form-data" class="dropzone" id="dropzone">
<script type="text/javascript">
Dropzone.options.dropzone =
    maxFilesize: 10,
    renameFile: function(file) {
        var dt = new Date();
        var time = dt.getTime();
    acceptedFiles: ".jpeg,.jpg,.png,.gif",
    addRemoveLinks: true,
    timeout: 5000,
    success: function(file, response) {
    error: function(file, response){
        return false;

Step 5. Define Routes

We will create two routes for the view blade file and a second route for the uploaded image to the server.

Route::get('image/show', [ImageZoneController::class, 'show']);
Route::post('image/upload', [ImageZoneController::class, 'upload']);

Step 6. Start Development Server

Use the below command and start your app development server.

php artisan serve

After starting the development server, copy the below URL and run it in your browser. you will see a dropzone, just drop some images in that and you will get to upload that image on the server.

We always thanks to you for reading our blogs.


Dharmesh Chauhan

(Swapinfoway Founder)

Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us


Haresh Chauhan


We Are Also Recommending You :