简体   繁体   中英

Amazon S3 PHP Class, can I upload a file directly to a folder in a bucket

To upload file into bucket root I use next code:

$s3->putObjectFile($logFile, $bucketName,basename($logFile), S3::ACL_PUBLIC_READ);

but how to put file into some folder?

I've tried smth like:

'folderName\\'. basename($logFile)

but it just add "folderName\\" to file name and upload it in root of bucket.

Use forward slash:

'forlderName/' . basename($logFile)

This article should explain why: http://docs.aws.amazon.com/AmazonS3/latest/dev/ListingKeysHierarchy.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM