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

test_user69's avatar

One time download link

Hello friends, I make api with laravel for video lesson selling app. How do I make download and watch link for only one time.I store my video in s3.

0 likes
2 replies
jayandholariya's avatar

Hey @test_user69

You can use try this

Storage::disk('s3')->temporaryUrl()

to make a temporary S3 link.

For one-time use you can do ->

Save a flag or token in DB when you create the link.

When user opens the link, check if it's already used.

If not used, allow and mark it as used.

If already used, block it or show error.

Also, better to send link from a controller — don’t give direct S3 URL. This way, you can control everything.

Please or to participate in this conversation.