I'm using the KnpGaufretteBundle to store pictures on Amazon S3, I can easily create a file with the following code :
public function s3CreatFileAction(Request $request) {
$filesystem = $this->get('knp_gaufrette.filesystem_map')->get('profile_photos');
$filesystem->write('test.txt', 'hello world');
[...]
}
The problem is that I can't access to the file ...
$filesystem = $this->get('knp_gaufrette.filesystem_map')->get('profile_photos');
$file = $filesystem->get('test.txt');
I got the following message :
The file "test.txt" was not found.
I assume that is because the "test.txt" file is created with a "private" acl (when I make it public trought the S3 console I can access to it).
So my question is how to define a public acl when I create my object ?
Ok guys it seems that KnpGaufretteBundle's doc looks like a jungle ☹ ...
Here is my solution :
At my first trials this code did not work because my AwsS3 user did not have the correct permissions on the bucket ! So be sure that your user's policy allows access on the bucket !