home / skills / noartem / skills / laravel-filesystem-uploads-and-urls
This skill helps manage Laravel file uploads via Storage, generate URLs, enforce visibility, and stream securely across disks.
npx playbooks add skill noartem/skills --skill laravel-filesystem-uploads-and-urlsReview the files below or copy the command above to add this skill to your agents.
---
name: laravel-filesystem-uploads
description: Store and serve files via Storage; set visibility, generate URLs, and handle streaming safely
---
# Filesystem Uploads and URLs
Use the Storage facade consistently; abstract away the backend (local, S3, etc.).
## Commands
```
$path = Storage::disk('public')->putFile('avatars', $request->file('avatar'));
// Temporary URLs (S3, etc.)
$url = Storage::disk('s3')->temporaryUrl($path, now()->addMinutes(10));
// Streams
return Storage::disk('backups')->download('db.sql.gz');
```
## Patterns
- Keep user uploads under a dedicated disk with explicit `visibility`
- Avoid assuming local paths; always go through Storage
- For public assets, run `storage:link` and serve via web server / CDN
- Validate mime/types and size limits at upload boundaries
This skill provides a practical set of helpers and patterns to store, serve, and stream files using Laravel's Storage abstraction. I focus on consistent use of disks, safe streaming, visibility settings, and URL generation so uploads work across local, S3, and other drivers. The goal is predictable file handling and secure public access when needed.
I standardize file interactions through the Storage facade: saving files to named disks, setting explicit visibility, and avoiding direct filesystem paths. The skill includes examples for creating temporary signed URLs on cloud drivers, returning streamed downloads from disks, and ensuring public assets are served via storage symlinks or CDN. Validation and mime checks are applied at upload boundaries.
How do I serve files publicly on local development?
Run php artisan storage:link and use the public disk; serve via webserver or a CDN for production.
When should I use temporaryUrl vs download stream?
Use temporaryUrl for short-lived external links (cloud drivers). Use streamed download responses when you must control headers or serve directly from the app.