Customer parameter are not going through for file delete

88 Views Asked by At

I have setup to directly upload image to s3 bucket and I am using fine uploader for that.

I am trying to send filename as parameter (to end point) while deleting a file.

Given below is callback snippet .

onDelete: function(id) {
    $(this).setDeleteFileParams({ filename: this.getName(id) });
}

It is working fine for newly uploaded files, but I already have files through initialList (Option) and when I try to delete them the filename param is not going through.

1

There are 1 best solutions below

0
On

You are not using the jQuery wrapper correctly. This is one of many reasons why I have suggested avoiding jQuery and the jQuery wrapper, as the "vanilla" API is much more intuitive. You've left out some code, but it looks like you are actually declaring your event handler as a property of the callbacks config object, which means you can avoid the jQuery wrapper entirely.

onDelete: function(id) {
    var name = this.getName(id);
    this.setDeleteFileParams({filename: name}, id);
}

But this code is not necessary, as Fine Uploader S3 sends the name of the object in S3 as a "key" parameter with the delete request.