Oct 4, 2016
0
Level 4
Uploading Image via Storage to S3 with Cache Control
Hi,
I'm trying to upload a file to an S3 bucket and wanted to make sure I am thinking about this correctly. When using the Storage facade you pass extra settings as a fourth argument correct?
In my example, to set cache control you would pass CacheControl with a value of max-age=86400 or is this wrong?
// Setup
$location = '/home/image.jpg';
$destination = '/uploads/image.jpg'
$s3 = Storage::disk('s3');
$settings = ['CacheControl' => 'max-age=86400'];
// Upload
$s3->put($destination, fopen($location, 'r+'), 'public', $settings );
Thanks, Kevin
Please or to participate in this conversation.