如何更新AWS S3文件权限? [英] How update AWS S3 file permission?

查看:398
本文介绍了如何更新AWS S3文件权限?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我使用node.js使用Multipart Upload将视频上传到Amazon-S3我正在使用 [ ^ ]参考



默认情况下上传的视频只能由所有者访问。



使用以下代码上传文件时



Hi,

I uploading videos using Multipart Upload to Amazon-S3 using the node.js. I am using the this[^] reference

The uploaded video by default is only accessible to owner.

When uploading file using below code

var params_to_upload_on_S3 = {
                    ACL: 'public-read',
                    Bucket: imageBucket,
                    Key: imgName  + ".jpg",
                    Body: imageBuffer,
                    ContentType : 'Image/jpg'
                }

            s3.putObject(params_to_upload_on_S3 , function (err, res) {
                if(err)
                    console.log('Thumnail Upload Error'+ err);
                else 
                    console.log('Thumbnail Successfully uploaded .'+ JSON.stringify(res));

                fs.unlink(imagePath, function(){
                    console.log('File deleted from local storage');
                });

            });





putObject有一个选项ACL:'public-read'来设置允许。但是我在MultipartUpload中找不到任何选项。



有没有更新现有文件权限的选项,还是可以在分段上传中设置权限?



"putObject" has a option ACL: 'public-read' to set the permission. but i didn't find any option in MultipartUpload.

Is there any option to update the permission of existing file or can set permission in Multipart Upload?

推荐答案

您好,



使用传输实用程序将文件上传到aws s3

[ ^ ]



在上面的链接中,您可以使用第四个选项上传带有元数据的文件。在元数据下,您可以更改文件的权限。



希望它对您有所帮助!
Hello,

Uploading file to aws s3 using transfer utility
[^]

In the above link, you can use the fourth option to upload file with meta data. Under meta data, you can alter the permissions for the file.

Hope it helps you!


这篇关于如何更新AWS S3文件权限?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆