So today I had to use the Jquery File Upload plugin which is absolutely neat, but I couldn’t find one thing in the documentation which was how can I bind the delete event to the file upload object. Therefore I dived into the code and found the solution. To make your life easier, I’m gonna share it!
$('#fileupload').bind('fileuploaddestroyed', function(e, data) {
// If you edit the default template, you can acquire some other
// information about the uploaded file (for example the file size)
var fileName = data.context.find('a[download]').attr('download');
$.post(
'/removePictureFromDatabase.php',
{
fileName: fileName
},
function(data, textStatus) {
// Process result
},
'json'
);
});