客户参数是不会通过的文件中删除参数、客户、文件

2023-09-11 10:04:50 作者:没有你,何为幸福

我已经建立直接上传图片到S3水桶和我使用细上传了点。

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.

下面给出的回调片段。

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

这是工作的罚款新上传的文件,但我已经有过 initialList 文件(选件),当我试图删除它们文件名参数是不会通过。

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.

推荐答案

您没有正确使用jQuery包装。这是很多原因我建议避免jQuery和jQuery的包装之一,作为香草的API更加直观。你忽略了一些code,但它看起来像你实际上声明事件处理程序的回调配置对象的属性,这意味着你可以避开jQuery的包装完全。

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);
}

但是,这code是没有必要的,因为精细上传S3将在S3中的对象的名称为关键参数的删除请求。