Вопрос:

Can't delete file in Fine uploader

javascript node.js amazon-web-services express amazon-s3

131 просмотра

1 ответ

6 Репутация автора

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"

            },......
Автор: Alvin Tan Источник Размещён: 07.04.2017 08:22

Ответы (1)


0 плюса

440 Репутация автора

Решение

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

Автор: Jakub Pastuszuk Размещён: 07.04.2017 09:30
Вопросы из категории :
32x32