You cannot delete anything without the server side of the script ..
In fact, you can use ajax and call the file on the server side to do this, for example.
Make file delete.php
<?php unlink($_GET['file']); ?>
and in javascript
function deleteImage(file_name) { var r = confirm("Are you sure you want to delete this Image?") if(r == true) { $.ajax({ url: 'delete.php', data: {'file' : "<?php echo dirname(__FILE__) . '/uploads/'?>" + file_name }, success: function (response) {
source share