简体   繁体   中英

Can't delete file in Fine uploader

I used node js sever code to upload files to aws s3. And succeed in uploading files to s3 bucket. But now i can't delete uploaded files from s3 bucket. in node js code are parameters of req.query.bucket and req.query.key. I don't understand what is meaning of bucket and key,so i don't know how to set this values in delete file options. Can you help me ?

node js API:

export function deletefile(req, res) {
   deleteFile(req.query.bucket, req.query.key, function(err) {
        if (err) {
            console.log("Problem deleting file: " + err);
            res.status(500);
        }
        res.end();
    });
};

delete file option of fine uploader in client

 ........
   deleteFile: {
                enabled: true,
                method: "POST",
                forceConfirm: true,
                endpoint: "/rest-api/deletefile"

            },......

According to documentation:

Each Amazon S3 object has data, a key, and metadata. Object key (or key name) uniquely identifies the object in a bucket. Object metadata is a set of name-value pairs. You can set object metadata at the time you upload it. After you upload the object, you cannot modify object metadata. The only way to modify object metadata is to make a copy of the object and set the metadata. [1]

So, you have to provide your bucket identifier, and your object identifier to delete given object from the bucket

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM