Skip to content

Instantly share code, notes, and snippets.

@KOUISAmine
Created February 8, 2017 00:32
Show Gist options
  • Save KOUISAmine/02c3adbc7495b2f3239dfaf6caadea8c to your computer and use it in GitHub Desktop.
Save KOUISAmine/02c3adbc7495b2f3239dfaf6caadea8c to your computer and use it in GitHub Desktop.
Simple upload en drag and drop avec MySQLi
<!DOCTYPE html>
<html lang = "en">
<head>
<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" />
</head>
<body>
<nav class = "navbar navbar-default">
<div class = "container-fluid">
<a class = "navbar-brand" href = "https://codes-src.blogspot.com">Codes Src</a>
</div>
</nav>
<div class = "row">
<div class = "col-md-3">
</div>
<div class = "col-md-6 well" style = "z-index:99999;">
<h3 class = "text-primary">Glisser-Déposer l'image avec MySQLi</h3>
<hr style = "border-top: 1px dotted #8c8b8b;"/>
<a href = "index.php">Retour</a>
<table class = "table table-bordered table-hover">
<thead>
<tr>
<th>Nom de l'image</th>
<th>Image</th>
</tr>
</thead>
<tbody>
<?php
$conn = new mysqli('localhost', 'root', '', 'image') or die(mysqli_error());
$stmt= $conn->prepare("SELECT * FROM `photo`") or die(mysqli_error());
if($stmt->execute()){
$result = $stmt->get_result();
}
while($fetch = $result->fetch_array()){
?>
<tr>
<td><?php echo $fetch['photo_name']?></td>
<td><center><img src = "<?php echo 'upload/'.$fetch['photo_name']?>" height = "50px" width = "50px"/></center></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</body>
<script src = "js/jquery-3.1.1.js"></script>
<script src = "js/upload.js"></script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment