Javascript 如何在Dropzone JS中从服务器删除现有/上传的图像?
我正在尝试从Dropzone JS中的服务器删除现有/上载的图像。每当我试图从服务器中删除现有映像时,都会遇到ReferenceError。请检查并指导我解决这个问题。这是我的密码 Product Edit.phpJavascript 如何在Dropzone JS中从服务器删除现有/上传的图像?,javascript,php,referenceerror,dropzone,Javascript,Php,Referenceerror,Dropzone,我正在尝试从Dropzone JS中的服务器删除现有/上载的图像。每当我试图从服务器中删除现有映像时,都会遇到ReferenceError。请检查并指导我解决这个问题。这是我的密码 Product Edit.php removedfile: function(file) { existingFiles_gallery.forEach(function(mockFile, index) { }); var fileName =
removedfile: function(file) {
existingFiles_gallery.forEach(function(mockFile, index) {
});
var fileName = mockFile.name;
$.ajax({
type: 'POST',
url: '/dropzone_upload.php',
data: {name: fileName,request: 'delete'},
sucess: function(data){
console.log('success: ' + data);
}
});
var _ref;
return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;
}
else{
$fileName = $targetPath.$_POST['name'];
unlink($fileName);
dropzone_upload.php
removedfile: function(file) {
existingFiles_gallery.forEach(function(mockFile, index) {
});
var fileName = mockFile.name;
$.ajax({
type: 'POST',
url: '/dropzone_upload.php',
data: {name: fileName,request: 'delete'},
sucess: function(data){
console.log('success: ' + data);
}
});
var _ref;
return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;
}
else{
$fileName = $targetPath.$_POST['name'];
unlink($fileName);
}
您的php文件不使用“请求:'删除”'