首页 > php > 每个用户的亚马逊s3文件夹

每个用户的亚马逊s3文件夹 (Amazon s3 folders for each user)

问题

我刚刚开始使用Amazon S3。我正在使用s3来允许我的应用用户上传图片。每个用户都可以上传一定数量的图像,他们可以管理他们的图像(上传,删除,替换)。

我不确定哪个是s3的最佳方法。我应该将所有图像上传到我的存储桶中的一个目录中,并在我的数据库中保存有关图像上传者的记录,还是为我的存储桶中的每个用户创建一个文件夹?

请分享您使用此服务的经验。

在此输入图像描述

在为每个用户存储上传时,哪种方法最有效?我可以使用的文件夹数量是否有限制?

解决方法

我们做出了类似的决定,用户可以上传多种格式的视频和图像,我们为每个用户创建了不同的文件夹。它的好处很少,比如1.它很容易维护。2.上传具有相同名称的文件的两个不同用户之间不会发生名称冲突。另外,正如Brenda所说,批量删除很容易。

我还建议你使用s3fs fuse,它将你的s3存储桶挂载为本地目录。这将使你的任务很简单。

问题

I'm just getting started with Amazon S3. I'm using s3 to allow my app users to upload images. Every user can upload a certain amount of images and they can manage their images (upload, delete, replace).

I'm not sure which is the best approach with s3. Should I upload all the images into one directory in my bucket and keep records in my database about image uploaders or create a folder for each user in my bucket?

Please share your experience with this service.

enter image description here

Which method works best when storing uploads for each user? Is there a limit on the number of folders that I can use?

解决方法

We had the similar decision to be made where users can upload multiple formats of videos and images and we created different folder for each user. It will have few benefits like 1. It is easy to maintain. 2. There will be no name conflicts between two different users uploading files with same name. 3. Also, as mentioned by Brenda, bulk delete will be easy.

I would also recommend you to use s3fs fuse which will mount your s3 bucket as local directory. It will make few of your task very easy.

相似信息