Laravel Storage and File Handling
January 16, 2026
•
1 min read
•
14 views
Table of Contents
File storage in Laravel:
Store File
$path = $request->file('avatar')->store('avatars');
$path = Storage::disk('s3')->put('avatars', $file);
Store with Name
$path = $request->file('avatar')->storeAs(
'avatars', $user->id.'.jpg'
);
Get File
$contents = Storage::get('file.txt');
$url = Storage::url('file.txt');
Delete File
Storage::delete('file.txt');
Storage::delete(['file1.txt', 'file2.txt']);
Check Existence
if (Storage::exists('file.txt')) {
// ...
}
Related Posts
Laravel Sanctum API Authentication Complete Guide
Build secure API authentication with Laravel Sanctum for SPAs and mobile apps.
Laravel Rate Limiting: Protect Your Application
Implement rate limiting to protect your Laravel application from abuse.
Laravel Blade Components: Build Reusable UI
Create powerful reusable components with Laravel Blade.
Comments (0)
No comments yet. Be the first to comment!