Hello I am trying to implement a drag and drog upload functionality using dropzone js framework.
Already I get the files uploaded succesfully using the below snippet
<link rel="stylesheet" href="https://rawgit.com/enyo/dropzone/master/dist/dropzone.css">
<form action="upload.php" class="dropzone"></form>
<script src="https://rawgit.com/enyo/dropzone/master/dist/dropzone.js">
</script>
<script>
//Disabling autoDiscover
Dropzone.autoDiscover = false;
$(function() {
//Dropzone class
var myDropzone = new Dropzone(".dropzone", {
url: "upload.php",
paramName: "file",
maxFilesize: 2,
maxFiles: 10,
acceptedFiles: "image/*,application/pdf"
});
});
</script>
Now I am trying to save the details of the uploaded details using this below
<?php
include_once("dbconf.php");
if(!empty($_FILES)){
$upload_dir = "media/";
$fileName = $_FILES['file']['name'];
$uploaded_file = $upload_dir.$fileName;
if(move_uploaded_file($_FILES['file']['tmp_name'],$uploaded_file)){
$mysql_insert = "INSERT INTO gallery (file)VALUES('".$fileName."')";
mysqli_query($conn, $mysql_insert) or die("database error:".
mysqli_error($conn));
}
}
?>
But the file details are not saved in the database.
Please note i have checked quite a number of implementations online that have almost the same implementation. they also do not work.
Please help