File Uploads and Storage: Managing User Files
Store uploaded files locally or in cloud storage using Laravel’s Storage facade.
Laravel provides a unified API for working with file systems. ## Store uploaded file ```php $path = $request->file('avatar')->store('avatars', 'public'); ``` ## Get URL ```php $url = Storage::disk('public')->url($path); ``` ## Storage flow ```mermaid flowchart LR A[Upload] --> B[Controller] B --> C[Storage API] C --> D{Disk} D -->|local| E[Local FS] D -->|s3| F[AWS S3] ``` This makes it easy to switch between local and cloud storage. In the next tutorial, we will notify users using Laravel notifications.