i work with the dropzone.js, upload plugin and PHP. I am trying to use dropzone show success Icon and print image preview, but it is not uploading my images to the upload directory. how can I fix this?
HTML:
<div class="dropzone dropzone-previews" id="my-awesome-dropzone">
<form action="<?PHP echo SITE.'/controller/'?>upload.php"></form>
<div class="fallback">
<input name="file" type="file" multiple />
</div>
</div>
JS:
<script>
$(document).ready(function(){
Dropzone.options.myAwesomeDropzone = { // The camelized version of the ID of the form element
// The configuration we've talked about above
url: '<?PHP echo SITE.'/controller/'?>upload.php',
previewsContainer: ".dropzone-previews",
uploadMultiple: true,
parallelUploads: 100,
maxFiles: 100
}
});
</script>
PHP:
<?php
$ds = DIRECTORY_SEPARATOR; //1
$storeFolder = '../../uploads/news/'; //2
if (!empty($_FILES)) {
$tempFile = $_FILES['file']['tmp_name']; //3
$targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds; //4
$targetFile = $targetPath. $_FILES['file']['name']; //5
move_uploaded_file($tempFile,$targetFile); //6
}
?>