0

I'm using the following to upload files to my Amazon S3 bucket using php:

$s3 = new S3(awsAccessKey, awsSecretKey);
$s3->putBucket("example", S3::ACL_PUBLIC_READ);
$s3->putObjectFile($fileTempName, "example", $fileName, S3::ACL_PUBLIC_READ);

How can I upload to example/subfolder?

This is not a duplicate - the answer was not clear and the question was different.

Amy Neville
  • 10,067
  • 13
  • 58
  • 94
  • Possible duplicate of [How to upload files to a Amazon S3 bucket subfolder via POST?](http://stackoverflow.com/questions/5512523/how-to-upload-files-to-a-amazon-s3-bucket-subfolder-via-post) – Narendrasingh Sisodia Apr 25 '16 at 09:58
  • I read that. The answer wasn't clear at all. And the question wasn't asked very well either. – Amy Neville Apr 25 '16 at 10:00
  • If a question is badly answered it doesn't mean it can't be asked again. If I am still confused many more people will be too. – Amy Neville Apr 25 '16 at 10:06
  • 1
    Your variable `$fileName` should consist the path where you need to upload at your bucket something like as `$fileName = "uploads/project/your_file_name.txt"` – Narendrasingh Sisodia Apr 25 '16 at 10:06
  • 1
    Ok, that works thanks! – Amy Neville Apr 25 '16 at 10:08
  • 1
    Glad it helped you... – Narendrasingh Sisodia Apr 25 '16 at 10:09
  • 1
    The reason I asked again was because the question was asked with no code example and then the answer was answered with a $variable totally out of any context and without even linking to any documentation page... – Amy Neville Apr 25 '16 at 10:10
  • Ok no issue I've already spent a day to read its docs you can access its docs over here http://docs.aws.amazon.com/AmazonS3/latest/dev/Welcome.html and for the very first time its too confusing to find what to write in `key` attribute of `putObject` method – Narendrasingh Sisodia Apr 25 '16 at 10:17

0 Answers0