JeremyFagis / dropify

Override your input files with style — Demo here : http://jeremyfagis.github.io/dropify
MIT License
973 stars 399 forks source link

Getting a value if user either remove or going with the default value #55

Open imam opened 7 years ago

imam commented 7 years ago

The use case is:

Is this use case built in already?

imam commented 7 years ago

Both cases, same output(null)

str commented 7 years ago

+1 with the same issue.

ernexus commented 4 years ago

As a temporary workaround you could use additional hidden input like this, gets the job done:

<input type="file" name="picture" class="dropify" data-default-file="file.jpg">
<input type="hidden" name="picture_removed" id="picture_removed" value="0">

And use js callback:

var drEvent = $('.dropify').dropify();
drEvent.on('dropify.afterClear', function(event, element){
$("#picture_removed").val("1");
});

And finally check in your php:

if($_POST['picture_removed'] == 1) {
unlink('file.jpg');
}
AhmedELGAMMUDI commented 4 years ago

did you get the answer