no , your method type is wrong .
add ( _method : delete ) in your data.
and your url should add the file id at the end after /.
Hi, i want to delete file from dropzone and i have a problem.
i upload photos with following function:
public function ImageSave(Request $r,$inputName) {
if($r->hasFile($inputName))
{
$pic = $r->file($inputName);
$name = $pic->getClientOriginalName();
$filename = uniqid() . $name;
$ext = $pic->move('uploads/products', $filename);
$imageAddress = 'uploads/products/'.$filename;
return $imageAddress;
}
}
when i upload new photo i added unique character before name of photo and i try to remove photo with following codes:
self.on("removedfile", function (file) {
$.ajax({
type: 'POST',
url: '/admin/productphoto/delete/',
data: {id: file.name, _token: $('input[name="_token"]').val()},
dataType: 'html',
success: function(data){
var rep = JSON.parse(data);
if(rep.code == 200)
{
photo_counter--;
$("#photoCounter").text( "(" + photo_counter + ")");
self._updateMaxFilesReachedClass();
}
}
});
});
but when i passed file name for delete can not find photo because i added unique character before name
what should i do?
Please or to participate in this conversation.