dropify
dropify copied to clipboard
Getting a value if user either remove or going with the default value
The use case is:
- If I click remove button, it's should send null in the request (So I know the user don't want to send a new picture, and they want to remove the current existing photo in the server)
- If I don't click the remove button, it should send back to the default file value (So I know the user don't want to send a new picture, neither removing the existing one that already on the server).
Is this use case built in already?

Both cases, same output(null)
+1 with the same issue.
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');
}
did you get the answer