custom ajax multiple file uploading Dropzone using PHP – Technology

custom ajax multiple file uploading Dropzone using PHP – Technology

In this post we will give you information about custom ajax multiple file uploading Dropzone using PHP – Technology. Hear we will give you detail about custom ajax multiple file uploading Dropzone using PHP – TechnologyAnd how to use it also give you demo for it if it is necessary.

Today, We want to share with you custom ajax multiple file uploading Dropzone using PHP.In this post we will show you Drag and Drop File Upload using DropzoneJS and PHP, hear for drag and drop multiple image upload in php we will give you demo and example for implement.In this post, we will learn about Drag and Drop ajax file upload using DropzoneJS and PHP with an example.

custom ajax multiple file uploading Dropzone using PHP

There are the Following The simple About custom ajax multiple file uploading Dropzone using PHP Full Information With Example and source code.

As I will cover this Post with live Working example to develop Dropzone.js with php multiple files upload, so the PHP – multiple file uploading dropzone js for this example is following below.

Create Database Table

CREATE TABLE 'users_mst' (
 'id' int(11) NOT NULL AUTO_INCREMENT,
 'img_flname' varchar(255) COLLATE utf8_unicode_ci NOT NULL,
 'dt_updated' datetime NOT NULL,
 PRIMARY KEY ('id')
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Database Configuration

conn_db.php

<?php
//Simple Config Database configuration
$dbHost     = "localhost";
$dbUsername = "myUsername";
$dbPassword = "mypasswordeneter";
$dbName     = "onlinecode";

// Create PHP MySQL database connection
$db = new mysqli($dbHost, $dbUsername, $dbPassword, $dbName);

//simple PHP MySQL Check connection
if ($db->connect_error) {
    die("Connection failed: " . $db->connect_error);
}
?>

Drag and Drop File Upload

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

index.html

<script src="plugin/jquery.js"></script>
<link rel="stylesheet" href="plugin/bootstrap-3.min.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.0.1/min/dropzone.min.css" rel="stylesheet">
<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.2.0/min/dropzone.min.js">
<h1>Dropzone Multiple File Upload using PHP Example</h1>
<form action="do_upload.php" ></form>
<a href="https://onlinecode.org/" target="_blank" alt="onlinecode" title="onlinecode">Free Download Example - onlinecode</a>

Upload Files to the PHP Server

do_upload.php

<?php
if(!empty($_FILES)){
    require 'conn_db.php';
    
    $baseFolder = "uploads/";
    $fileName = $_FILES['file']['name'];
    $targetFilePath = $baseFolder.$fileName;
    
    if(move_uploaded_file($_FILES['file']['tmp_name'], $targetFilePath)){
        $insert = $db->query("INSERT INTO users_mst (img_flname, dt_updated) VALUES ('".$fileName."', NOW())");
    }
}
?>

View / Preview Uploaded Files

<?php
require 'conn_db.php';

$query = $db->query("SELECT * FROM users_mst ORDER BY id DESC");

if($query->num_rows > 0){
    while($row = $query->fetch_assoc()){
        $destination_path = 'uploads/'.$row["img_flname"];
        $fileImgMime = mime_content_type($destination_path);
?>
	<embed src="<?php echo $destination_path; ?>" type="<?php echo $fileImgMime; ?>" width="450px" height="380px" />
<?php }
}else{ ?>
    <p>No Any Images / file(s) found...</p>
<?php } ?>


Customize PHP DropzoneJS Drag and Drop jquery Ajax Upload

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div ></div>
<a href="https://onlinecode.org/" target="_blank" alt="onlinecode" title="onlinecode">Free Download Example - onlinecode</a>
<script>
//Disabling autoDiscover
Dropzone.autoDiscover = false;

$(function() {
    //My Multiple Images/ files upload Dropzone class
    var liveDropzone = new Dropzone(".dropzone", {
		url: "do_upload.php",
		paramName: "imgvalues",
		maxFilesize: 10,
		maxFiles: 5,
		acceptedFiles: "image/*,application/pdf"
	});
});
</script>


Upload with Custom Button in Dropzone

<div ></div>
	
<button id="multiple_upload">UPLOAD</button>

<script>
//Disabling autoDiscover
Dropzone.autoDiscover = false;

$(function() {
    //Dropzone class
    var liveDropzone = new Dropzone(".dropzone", {
		url: "do_upload.php",
		paramName: "imgvalues",
		maxFilesize: 10,
		maxFiles: 5,
		acceptedFiles: "image/*,application/pdf",
		autoProcessQueue: false
	});
	
	$('#multiple_upload').click(function(){           
		liveDropzone.processQueue();
	});
});
</script>
Angular 6 CRUD Operations Application Tutorials

Read :

Another must read:  Drag And Drop Multiple File Uploading using DropzoneJS and PHP Example

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about custom ajax multiple file uploading Dropzone using PHP.
I would like to have feedback on my onlinecode blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Hope this code and post will helped you for implement custom ajax multiple file uploading Dropzone using PHP – Technology. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  20  =  22

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US