PHPackages                             mustafaomar/laravel-fileuploader - 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. mustafaomar/laravel-fileuploader

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

mustafaomar/laravel-fileuploader
================================

A simple package for uploading media and storing media urls in database

v1.0.1(5y ago)3171MITPHP

Since Jun 24Pushed 4y ago1 watchersCompare

[ Source](https://github.com/themustafaomar/laravel-fileuploader)[ Packagist](https://packagist.org/packages/mustafaomar/laravel-fileuploader)[ RSS](/packages/mustafaomar-laravel-fileuploader/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

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

[](#installation)

You can install it via [composer](https://getcomposer.org/)

```
$ composer require mustafaomar/laravel-fileuploader

```

Publishing
----------

[](#publishing)

Publishing config file `fileuploader.php`

```
php artisan vendor:publish --tag=fileuploader-config
```

If you intend to store urls in database via this package, you need to publish the migration and model

```
php artisan vendor:publish --tag=fileuploader-migrations
```

If you want publish all

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

Configuration
-------------

[](#configuration)

**`disk`**: A filesystem's disk

**`model`**: The model class

**`url_column`**: The name of the column you want to store the image link

Usage
-----

[](#usage)

There are serveral ways to start using `laravel-fileuploader`

### Uploadable trait

[](#uploadable-trait)

You can use `Uploadable` in your controller and we're done, you now have access to the `uploader` method, example.

TestController.php

```
use FileUploader\Traits\Uploadable;

class TestController extends Controller
{
    use Uploadable;

    public function store(Request $request)
    {
        $this->uploader()->save($request->file('image'))->to('/products');
    }
}
```

**Notice**: This image will be saved to the storage, and to be more specific it depends on how you're configuring the disk option in the `fileuploader.php` and the default disk is `public`So, this file will be stored in: `/laravel-app/storage/app/public/products/[hashname]`

#### Getting the url

[](#getting-the-url)

You may want to get the url to store it in the database, you can return the url as following.

```
public function store(Request $request)
{
    $this->uploader()->save($request->file('image'))->to('/products')->getUrl(); // /storage/products/[hashname]
}
```

Now you can use `asset(URL)` method to show this image somewhere.

You can also quickly pass the image to the `uploader` method as the first argument, and path as the second.

```
$this->uploader($request->image, '/products')->getUrl();
```

### Using Facade

[](#using-facade)

```
use FileUploader\Facades\FileUploader;

public function store(Request $request)
{
    $url = FileUploader::save($request->file('image'))->to('/products')->getUrl();
}
```

### Using app and make method

[](#using-app-and-make-method)

Just wanted to mention that you can use `make` method to resolve the `fileuploader` from the container.

```
public function store(Request $request)
{
    app()->make('file.uploader')->save($request->file('images'))->to('/path/to');

    // OR
    app('file.uploader')->save($request->file('images'))->to('/path/to');
}
```

Saving many files at once
-------------------------

[](#saving-many-files-at-once)

You can of course, pass an array of images to the `uploader` method or using `saveMany` method, let's give it a try.

```
public function store(Request $request)
{
    $this->uploader($request->images, '/products');

    // OR

    $this->uploader()->saveMany($request->file('images'))->to('/products')->getUrls(); // Returns: \Illuminate\Support\Collection
}
```

Saving urls in database
-----------------------

[](#saving-urls-in-database)

You can save the files in disk and save the generated urls in the database with one line of code, just don't forget to publish the migrations

**Notice**: I assume you have a model for example `Product` and each product has many images, and in order make this work

you have to add a relation within that `Product` like so:

```
// Product.php

public function media()
{
    return $this->morphMany(Media::class, 'mediable');
}
```

Now you have to pass the newly created `Product` model to `toDatabase` method, see this example

Notice If you want to add other columns to media table feel free to do that, then you will need to pass these additional columns to `toDatabase` method as the second paramater

```
public function store(Request $request)
{
    $product = Product::create($request->all());

    $this->uploader($request->file('images'), '/products')
         ->toDatabase($product, [
            'other_column' => $request->other_column
         ]);
}
```

Sometimes you may want to get the urls and do whatever you want with them.

```
public function store(Request $request)
{
    $product = Product::create($request->all());

    $product->media()->saveMany(
        $this->uploader($request->file('images'), '/products')->getUrls()
             ->map(function ($url) {
                return new MyMediaClass(['media_url' => $url]);
             });
    );
}
```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1836d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23484701?v=4)[Mustafa Asaad](/maintainers/mustafaomar)[@mustafaomar](https://github.com/mustafaomar)

---

Top Contributors

[![themustafaomar](https://avatars.githubusercontent.com/u/46113191?v=4)](https://github.com/themustafaomar "themustafaomar (5 commits)")

### Embed Badge

![Health badge](/badges/mustafaomar-laravel-fileuploader/health.svg)

```
[![Health](https://phpackages.com/badges/mustafaomar-laravel-fileuploader/health.svg)](https://phpackages.com/packages/mustafaomar-laravel-fileuploader)
```

PHPackages © 2026

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