Laravel Packagev13.xMIT License1.5K+ downloads

Laravel Uploader: Upload once, serve it right

Laravel Uploader stores every upload on the Laravel disk you choose, under an unguessable hashed name, and keeps a record of it in an uploads table. You get the right URL for each file, whether it lives on a local disk, a public disk, or a private S3 bucket, plus image thumbnails and visibility changes in one call.

$composer require pharaonic/laravel-uploader
Key Features

Everything you need to handle uploads

Pass a file to `upload()` and get back a model that knows its URL, size and thumbnail.

Any Disk

Store on local, public, s3 or any disk from config/filesystems.php, per upload or by default.

Hashed File Names

Every file gets a random 67-character hash, so its name and URL cannot be guessed.

Image Thumbnails

Generate a resized thumbnail with a width, a height, or both, keeping the aspect ratio when you ask.

Visibility Control

Switch an S3 file between public() and private() and the stored object follows on save().

The Right URL

$upload->url returns a route for local files, a temporary URL for private S3 files, and the disk URL otherwise.

Safe File Route

Local files stream without sessions or cookies, with nosniff, and risky types are sent as downloads.

A quick look

Store an avatar with a thumbnail and keep its hash on the user.

app/Http/Controllers/AvatarController.php
1public function update(Request $request)
2{
3 $upload = upload($request->file('avatar'), [
4 'path' => 'avatars',
5 'thumbnail' => ['width' => 200, 'ratio' => true],
6 ]);
7 
8 $request->user()->update(['avatar' => $upload->hash]);
9 
10 return ['url' => $upload->url, 'thumbnail' => $upload->thumbnail->url];
11}
FAQ

Laravel Uploader Questions

Quick answers about installing and using Laravel Uploader.

What is Laravel Uploader?

Upload files to any Laravel disk with hashed names, image thumbnails, visibility control and secure URLs, through a facade, helpers and an Eloquent model. It's a free, open-source Laravel package by Pharaonic.

How do I install Laravel Uploader?

Run composer require pharaonic/laravel-uploader in your project's root directory, then php artisan migrate to create the uploads table.

What does Laravel Uploader require?

The latest release requires PHP 8.3+ and Laravel 13. Thumbnails also need the GD or Imagick extension.

Does it work with Amazon S3?

Yes. Upload to any S3 disk, set each file's visibility, and private files get temporary URLs that expire after the minutes you configure.

Can anyone open a file on a local disk?

Local files are served by the package route to anyone holding the URL. The URL contains a random 67-character hash, so it cannot be guessed, but treat it like a share link. Use a private S3 disk for files that need expiring access.

Is Laravel Uploader free to use?

Yes. Laravel Uploader is open source under the MIT license, so you can use it in personal and commercial projects.

Where can I find the Laravel Uploader documentation?

Read the Laravel Uploader documentation for setup, configuration, and usage examples.

How do I report a bug or contribute to Laravel Uploader?

Open an issue or a pull request on GitHub, or ask in the Pharaonic Discord.

Ready to dig in?

Read the full documentation for installation, configuration, upload options, thumbnails, URLs and visibility, the file route, and the complete API reference.