Laravel 5.8 Dropzone Multiple Image Uploading

In this tutorial you will learn about the Laravel 5.8 Dropzone Multiple Image Uploading and its application with practical example.

Laravel 5.8 Dropzone Multiple Image Uploading

In this Laravel 5.8 Dropzone Multiple Image Upload with preview example, I will show you how to upload files with drag and drop interface using dropzone.js in your Laravel 5 applications. Dropzone is an open source light weight JavaScript library that provides drag and drop features to upload images with preview images. In this example before uploading the image we will display preview of the image and then save it into directory. In order to use dropzone plugin we need to include the Dropzone javascript and CSS files in your laravel blade file. This tutorial we learn to :-

  • Uploading multiple images with dropzone
  • Saving images with unique file names to database

Install Laravel 5.8

First of all we need to create a fresh laravel project, download and install Laravel 5.8 using the below command

Configure Database In .env file

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.


Generate Migration

Now, we have to define table schema for photos table. Open terminal and let’s run the following command to generate a migration file to create photos table in our database.

Once this command is executed you will find a migration file created under “database/migrations”. lets open migration file and put following code in it –

Run Migration

Now, run following command to migrate database schema.

Recommended:-  AngularJS CRUD With Php MySql REST API or Webservice Example

After, the migration executed successfully the photos table will be created in database along with migrations, password_resets and users table.

Create Model

Next, we need to create a model called Photo using below command.

Once, the above command is executed it will create a model file Photo.php in app directory.

Create Controller

Now, create a controller to upload image. Create a controller named ImageUploadController using command given below –

Once the above command executed, it will create a controller file ImageUploadController.php in app/Http/Controllers/dropzone_image_upload/ directory. Open the ImageUploadController.php file and put the following code in it.


Here In the controller, we have following methods –

Recommended:-  Laravel 6 Import Excel CSV File to Database Using Maatwebsite

index() :- It displays Drozone Multiple Image Upload Form

store() :- To Upload using Dropzone and Save Multiple Image in database.

Note:- Before uploading any file make sure you have created following two directory in the public folder called profile_images.

Create Blade / View Files

In this step, we will create view/blade file to display Image Upload Form. Lets create a blade file “index.blade.php” in “resources/views/dropzone_image_upload/” directory and put the following code in it respectively.

Include Dropzone Javascript and CSS files

In order to use dropzone plugin we need to include following Dropzone javascript and CSS files in your laravel blade file.

Dropzone CSS :-

In this file we will be adding dropzone.min.css along with the our bootstrap.min.css as following –

Dropzone Javascript :-

Here we will add dropzone.js file along with the jquery.js as following –

Configure Dropzone Plugin with Remove Image Link

Next, we will provide initial configurations for Dropzone plugin.We setup follwoing dropzone options –

maxFilesize:- Maximum Image size that can be uploaded.

renameFile:- It is used to rename the file before uploading.

acceptedFiles:- File types or extension that can be uploaded.

Now, our blade file will look something like this.


Create Routes

After this, we need to add following dropzone image upload routes in “routes/web.php” file along with a resource route. Lets open “routes/web.php” file and add following route.

Recommended:-  Laravel 5.8 Facebook Login with Socialite


Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –




After Image Upload Screen Output:-

Select and Drop Multiple Image files to upload using dropzone.


In this tutorial we have learn about the Laravel 5.8 Dropzone Multiple Image Uploading and its application with practical example. I hope you will like this tutorial.