douxu3732 2012-09-06 01:08
浏览 118
已采纳

如何通过PHP SDK在Amazon S3存储桶下创建文件夹?

I am developing an iPhone app to allow user upload photo and share. I want to use S3 to store uploaded images as well as processed images (foe example, thumbnail, reduced size image). I've installed AWS PHP SDK on my EC2 instance, my questions are: 1) Should photos uploaded from iPhone app go to a EC2 directory first, then copied over to S3 bucket, or it should directly uploaded to S3? 2) How can I create different folders under the S3 bucket through PHP SDK and how to read the files from the folder?

Thanks in advance!

  • 写回答

2条回答 默认 最新

  • douwu7563 2012-09-06 09:34
    关注
    1. The answer can be found here: Direct upload to s3 without the use of a production server

    2. I've never used the PHP SDK, but I was browsing through the AWS SDK for PHP 1.5.14 documentation and came across the following APIs that you will need to utilize:

      a) create_object : You'll use this to put a object into a bucket. You'll specify the filename. You asked how you can create different folders: you will include the full path into the filename. For instance instead of naming the file "photo1.jpg", you would name it "user1/vacation/photo1.jpg".

      b) get_object_list : This API will return to you a list of objects given some criteria. If you want to read all the objects from a particular folder, specify the prefix as the path to the folder. For instance, if I want to find all files in the folder "user1/vacation/", I would specify my prefix to be "user1/vacation/".

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Python语言实验
  • ¥15 SAP HANA SQL 增加合计行
  • ¥20 用C#语言解决一个英文打字练习器,有偿
  • ¥15 srs-sip外部服务 webrtc支持H265格式
  • ¥15 在使用abaqus软件中,继承到assembly里的surfaces怎么使用python批量调动
  • ¥15 大一C语言期末考试,求帮助🙏🙏
  • ¥15 ch340驱动未分配COM
  • ¥15 Converting circular structure to JSON
  • ¥30 Hyper-v虚拟机相关问题,求解答。
  • ¥15 TSM320F2808PZA芯片 Bootloader