Как добавить путь к картинкам в БД?
<h3>Галерея</h3>
<div class="submit-section">
<form action="submit-property.php" class="dropzone" id="my-dropzone"></form>
</div>
На сервер картинки загружаются,а в БД нет.
<?php
$ds= DIRECTORY_SEPARATOR;
$storeFolder = 'user_data';
if (!empty($_FILES)) {
$tempFile = $_FILES['file']['tmp_name'];
$targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds;
$targetFile = $targetPath. $_FILES['file']['name'];
$query=mysqli_query($con,"INSERT into images (id_room,name_image) VALUES('$id_room','$targetFile')");
move_uploaded_file($tempFile,$targetFile);
}
?>
<script src="dropzone.js"></script>
<script>
Dropzone.options.myDropzone = {
init: function() {
thisDropzone = this;
$.get('submit-property.php', function(data) {
$.each(data, function(key,value){
var mockFile = { name: value.name, size: value.size };
thisDropzone.options.addedfile.call(thisDropzone, mockFile);
thisDropzone.options.thumbnail.call(thisDropzone, mockFile, "user_data/"+value.name);
});
});
}
};
</script>