i am unable to upload image using dropzone.js in php.
i have tried everything but nothing work for me.
MY HTML Code
<form method="post" enctype="multipart/form-data">
<div class="dropzone" id="mydropzone">
<input type="file" name="img">
<div class="dropzone-previews"></div>
</div>
<button type="submit" id="submitbtn">Upload</button>
</form>
MY Javascript Code
Dropzone.options.mydropzone = {
url:"upload.php",
uploadMultiple: true,
maxFilesize: 99,
maxFiles : 3,
autoDiscover:false,
acceptedFiles: ".png,.jpg,.jpeg",
previewsContainer: '.dropzone-previews',
autoProcessQueue : false,
parallelUploads: 100,
addRemoveLinks: true,
init:function(){
var myDropzone = this;
$("#submitbtn").on('click',function(e) {
e.preventDefault();
myDropzone.processQueue();
});
}
}
MY PHP Code (I Tried it work 100% fine but with dropzone.js not work) $upload_dir = "img/";
$name = $_FILES['img']['name'];
$tmp_file = $_FILES['img']['tmp_name'];
move_uploaded_file($tmp_file, $upload_dir.$name);