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

mateoo88's avatar

Displaying files from the cloud.

Does anyone of you use Backblaze.com as cloud storage for storing files in a Laravel application? I didn't want to use Amazon S3, so I am testing Backblaze. I created a private bucket and configured Laravel. Uploading files works well, but I can't figure out how to display images (e.g. in Blade). I am creating a TemporaryUrl in the controller:

$file = Storage::disk('b2')->temporaryUrl("d5443f7e-a109-443d-b4c0-48af21562485.jpeg", now()->addMinutes(5));

and trying to display it in Blade:

<img src="{{ $file }}" alt="Image 1" class="w-full h-32 object-cover rounded-lg transition-transform transform scale-100 group-hover:scale-105" />

but it doesn't work, I get an error:

<Error>
<Code>UnauthorizedAccess</Code>
<Message>bucket is not authorized: ...</Message>
</Error>

Has anyone of you used Backblaze and encountered a similar problem?

0 likes
1 reply
mateoo88's avatar
mateoo88
OP
Best Answer
Level 2

I found what was causing the problem! When passing the link from the controller to Blade, Laravel (probably for security reasons) was modifying parts of the link, e.g., changing https:// to https%3A, which caused the error.

Instead of generating the temporary URL in the controller, I now do it in Blade:

{{ Storage::disk('b2')->temporaryUrl('d5443f7e-a109-443d-b4c0-48af21562485.jpeg', '+5 minutes') }}

and everything works!

Please or to participate in this conversation.