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

如何通过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 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用