kevindees's avatar

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

0 likes
0 replies

Please or to participate in this conversation.