Amazon S3 PHP类,我可以直接将文件上传到bucket中的文件夹中吗


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

要将文件上传到bucket根目录,我使用下一个代码:

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

但是如何将文件放入文件夹?

我试过类似的smth

'folderName'''. basename($logFile)

但它只是在文件名中添加"folderName''",并将其上传到bucket的根目录中。

使用正斜杠:

'forlderName/' . basename($logFile)

本文应解释原因:http://docs.aws.amazon.com/AmazonS3/latest/dev/ListingKeysHierarchy.html