I am using dropzone for file upload. I want to delete the files on the server when the removeLink
is clicked. For that I use Ajax which opens the .php site. But somehow I can't pass the filename of the file which should be deleted (the delete_image.php
works). How can I pass the filename so it can be deleted?
addRemoveLinks: true,
removedfile: function(file) {
$.ajax({
type: 'POST',
url: 'delete_image.php',
data: {name: +file, dir: "<? echo $_GET['id']; ?>"},
});
var _ref;
return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;
}
Credit: code from this site