I'm using dropzone.js
. Is there a way I can get the filename
on the click event of removefile
? I was thinking of getting the filename
from dz-filename
's IMG
alt and remove the image from the database and server. If there's another way that'd be great too!
But this is what I have and it gives me undefined as the name:
<div class="dz-preview dz-image-preview">
<div class="dz-details">
<div class="dz-filename">
<span data-dz-name="">d24baa48eb1b8ed17755796425141fdc.jpg</span>
</div>
<div class="dz-size" data-dz-size="">
<strong>9</strong> KiB
</div>
<img data-dz-thumbnail="" alt="d24baa48eb1b8ed17755796425141fdc.jpg" src="/images/thumbnail/d24baa48eb1b8ed17755796425141fdc.jpg">
</div>
<a class="dz-remove" href="javascript:undefined;" data-dz-remove="">Remove file</a>
</div>
I also tried: siblings
, find
and closest
.
this.on("removedfile", function(file) {
var name = $(this).parent(".dz-image-preview")
.siblings(".dz-details").children("img").attr("alt");
alert(name);
});