Add folder in Amazon s3 bucket

前端 未结 16 1365
青春惊慌失措
青春惊慌失措 2021-02-06 23:34

I want to add Folder in my amazon s3 bucket using coding. Can you please suggest me how to achieve this?

16条回答
  •  天涯浪人
    2021-02-06 23:58

    In swift 2.2 you can create folder using

    func createFolderWith(Name: String!) {
        let folderRequest: AWSS3PutObjectRequest = AWSS3PutObjectRequest()
        folderRequest.key = Name + "/"
        folderRequest.bucket = "Your Bucket Name"
        AWSS3.defaultS3().putObject(folderRequest).continueWithBlock({ (task) -> AnyObject? in
            if task.error != nil {
                assertionFailure("* * * error: \(task.error?.localizedDescription)")
            } else {
                print("created \(Name) folder")
            }
            return nil
        })
    }
    

提交回复
热议问题