Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Mindexperiment's avatar

Access private S3 files

Hi guys,

I need to access private files uploaded to S3.

All files are video that I want to preview to clients, but once they are uploaded to the bucket as private I'm unable to list them.

Apart from the upload process that goes well, I summarize what I've done so far

 public function getStorageUrl() {
  $client = Storage::disk( $this->storage )->getAdapter()->getClient();
  return $client->getObjectUrl( env('AWS_BUCKET'), $this->path );
 }

  • It's all setup and $video->getStorageUrl() return the correct url.

Clearly the url from this method points to a private file and it is not served by the bucket.

I need to be able to get a "temporary public url(??)", I have to use ACL on the bucket, what? and how?

0 likes
1 reply
Mindexperiment's avatar

I found that temporaryUrl has to be the solution to the problem.

The method getObjectUrl becomes:

public function getStorageUrl() {
 return Storage::disk( $this->storage )->temporaryUrl( $this->path, now()->addMinutes(5) );
}

but the url doesnt fetch the video

Please or to participate in this conversation.