PHPackages                             erlandmuchasaj/laravel-file-uploader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. erlandmuchasaj/laravel-file-uploader

ActiveLibrary[File &amp; Storage](/categories/file-storage)

erlandmuchasaj/laravel-file-uploader
====================================

A simple package to help you easily upload files to your laravel project.

1.2.2(1y ago)128.7k↓33.3%2MITPHPPHP ^8.2

Since Mar 6Pushed 1y ago2 watchersCompare

[ Source](https://github.com/erlandmuchasaj/laravel-file-uploader)[ Packagist](https://packagist.org/packages/erlandmuchasaj/laravel-file-uploader)[ Docs](https://github.com/erlandmuchasaj/laravel-file-uploader)[ Fund](https://ko-fi.com/erlandmuchasaj)[ Fund](https://paypal.me/emcms?country.x=AL&locale.x=en_US)[ RSS](/packages/erlandmuchasaj-laravel-file-uploader/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (5)Versions (12)Used By (0)

Laravel File Uploader
=====================

[](#laravel-file-uploader)

Laravel File Uploader offers an easy way to upload files to different disks. The main purpose of the package is to remove the repeated and cumbersome code and simplify it into some simple methods.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require erlandmuchasaj/laravel-file-uploader
```

Usage
-----

[](#usage)

This package has an very easy and straight-forward usage. Just import the package and pass the file as parameter, and it will handle the rest.

```
use ErlandMuchasaj\LaravelFileUploader\FileUploader;

Route::post('/files', function (\Illuminate\Http\Request $request) {

    $max_size = (int) ini_get('upload_max_filesize') * 1000;

    // FileUploader::images() get all image extensions ex: jpg, png, jpeg, gif, etc.
    // FileUploader::documents() get all documents extensions ex: 'csv', 'html', 'pdf', 'doc', 'docx', 'ppt' etc.
    $extensions = implode(',', FileUploader::images());

    $request->validate([
        'file' => [
            'required',
            'file',
            'image',
            'mimes:' . $extensions,
            'max:'.$max_size,
        ]
    ]);

    $file = $request->file('file');

    $response = FileUploader::store($file);
    // $response = FileUploader::store($file, $options);
    // available options (as key=>value pare) are:
    // `disk`, 'user_id`, `path`, `visibility`

    // do something with the $response
    // you can save it into your model etc.

    return redirect()
            ->back()
            ->with('success', __('File has been uploaded.'))
            ->with('file', $response);
})->name('files.store');

/**
 *  $response = [
 *      "type" => "image"
 *      "extension" => "png"
 *      "_extension" => "png"
 *      "name" => "blog3"
 *      "original_name" => "blog3.png"
 *      "size" => 549247
 *      "mime_type" => "image/png"
 *      "dimensions" => "670x841"
 *      "path" => "uploads/1/image/blog3_1678118034.png" //  "/storage/uploads/1/image/blog3_1678118034.png"
 *      "user_id" => 1
 *      "disk" => "local"
 *      "visibility" => "public"
 *      "uuid" => "dd5889c0-5057-49ef-a6ef-e3da961a47d1"
 *  ]
*/
```

If you need to modify the config files, you should publish the migration and the config/permission.php config file with:

```
php artisan vendor:publish --provider="ErlandMuchasaj\LaravelFileUploader\FileUploaderServiceProvider"
```

Some other helper methods:

```
    $path = 'uploads/1/image/blog3_1678118034.png'; // the path of the image where is stored.
    $response = FileUploader::get($path); // get file as StreamedResponse
    $response = FileUploader::getFile($path); // get file as content.
    $response = FileUploader::url($path); // full path url - /storage/uploads/1/image/blog3_1678118034.png
    $response = FileUploader::path($path); // C:\wamp\www\laravel-app\storage\app\uploads/1/image/blog3_1678118034.png
    $response = FileUploader::meta($path); // metadata about the file.
    /**
    * [
    *     "path" => "C:\wamp\www\laravel-app\storage\app\uploads/1/image/blog3_1678118034.png"
    *     "url" => "/storage/uploads/1/image/blog3_1678118034.png"
    *     "visibility" => "public"
    *     "mimeType" => "image/png"
    *     "size" => "536.37 KB"
    *     "last_modified" => "1 hour ago"
    *     "name" => "blog3_1678118034.png"
    *     "pathinfo" => [
    *         "dirname" => "uploads/1/image"
    *         "basename" => "blog3_1678118034.png"
    *         "extension" => "png"
    *         "filename" => "blog3_1678118034"
    *     ]
    * ]
    */

    $response = FileUploader::download($path, 'something_nice'); // download the file as StreamedResponse
    $response = FileUploader::getVisibility($path); // file visibility when applicable private/public
    $response = FileUploader::setVisibility($path, 'private'); // change file visibility
    $response = FileUploader::remove($path); // delete a file
```

Also, some other size converting helper functions are available for example:

```
    $size = 549247;
    FileUploader::formatBytes($size); // "536.37 KB"

    FileUploader::convertBytesToSpecified($size, 'KB'); // 536.37KB
    FileUploader::convertBytesToSpecified($size, 'MB'); // 0.52MB
```

---

Support me
----------

[](#support-me)

I invest a lot of time and resources into creating [best in class open source packages](https://github.com/erlandmuchasaj?tab=repositories).

If you found this package helpful you can show support by clicking on the following button below and donating some amount to help me work on these projects frequently.

[ ![buy me a coffee](https://camo.githubusercontent.com/58c5ff7fa04b3393e6eb6103b591ef6dceee6e1c64dc924ba2713a86b51d8cb7/68747470733a2f2f7777772e6275796d6561636f666665652e636f6d2f6173736574732f696d672f67756964656c696e65732f646f776e6c6f61642d6173736574732d322e737667)](https://www.buymeacoffee.com/erland)Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please see [SECURITY](SECURITY.md) for details.

Credits
-------

[](#credits)

- [Erland Muchasaj](https://github.com/erlandmuchasaj)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance44

Moderate activity, may be stable

Popularity31

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 87.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~72 days

Recently: every ~44 days

Total

11

Last Release

441d ago

PHP version history (2 changes)1.0.0PHP ^8.0

1.2.0PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/8d7469281a88a626e0fa6ba92fad648de2d1151e931b0ef844446539aa73660a?d=identicon)[erlandmuchasaj](/maintainers/erlandmuchasaj)

---

Top Contributors

[![erlandmuchasaj](https://avatars.githubusercontent.com/u/6152399?v=4)](https://github.com/erlandmuchasaj "erlandmuchasaj (14 commits)")[![KirePetrov](https://avatars.githubusercontent.com/u/45404506?v=4)](https://github.com/KirePetrov "KirePetrov (2 commits)")

---

Tags

file-uploadfileslaravellaravel-packagephplaravelpackagelibraryfileimagesmediacmsuploademcms

### Embed Badge

![Health badge](/badges/erlandmuchasaj-laravel-file-uploader/health.svg)

```
[![Health](https://phpackages.com/badges/erlandmuchasaj-laravel-file-uploader/health.svg)](https://phpackages.com/packages/erlandmuchasaj-laravel-file-uploader)
```

###  Alternatives

[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.3M74](/packages/unisharp-laravel-filemanager)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)[torann/mediasort

Attachment manager for Laravel.

2012.5k](/packages/torann-mediasort)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
