Simple Drag and Drop Image Upload with MySQL PHP Script

Simple Drag and Drop Image Upload with MySQL PHP Script

The Simple Drag and Drop Image Upload with MySQLi was develop by using MySQLi/jQuery. This simple source code uses jQuery function to process the image when being dragged and dropped into the drop zone. The given source code can teach you on how to drag and drop a simple image to an advanced approach. It is an user friendly kind of source code, feel free to modify it and use it to your project.

This a sample code for displaying the image that been upload


<!DOCTYPE html>
<html lang = "en">
<link rel = "stylesheet" type = "text/css" href = "css/bootstrap.css"/>
<link rel = "stylesheet" type = "text/css" href = "css/style.css"/>
<meta charset = "UTF-8" name= "viewport" content = "width=device-width, initial-scale=1" />
<nav class = "navbar navbar-default">
<div class = "container-fluid">
<a class = "navbar-brand" href = "<a href="">Sourcecodester</a>
" rel="nofollow">">Sourcecodester</a>
</a> </div>
<div class = "row">
<div class = "col-md-3">
<div class = "col-md-6 well" style = "z-index:99999;">
<h3 class = "text-primary">Drag and Drop Image Upload with MySQLi</h3>
<hr style = "border-top: 1px dotted #8c8b8b;"/>
<a href = "index.php">Back</a>
<table class = "table table-bordered table-hover">
<th>Image Name</th>
$conn = new mysqli('localhost', 'root', '', 'image') or die(mysqli_error());
$stmt= $conn->prepare("SELECT * FROM `photo`") or die(mysqli_error());
$result = $stmt->get_result();
while($fetch = $result->fetch_array()){
<td><?php echo $fetch['photo_name']?></td>
<td><center><img src = "<?php echo 'upload/'.$fetch['photo_name']?>" height = "50px" width = "50px"/></center></td>
<script src = "js/jquery-3.1.1.js"></script>
<script src = "js/upload.js"></script>

I hope that this simple source code can help you to your project and future project. For more updates and tutorials, just kindly visit this site. Enjoy Coding!!



Have any Question or Comment?

Leave a Reply

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