PHPackages                             kingofcode/laravel-uploadable - 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. kingofcode/laravel-uploadable

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

kingofcode/laravel-uploadable
=============================

Laravel Uploadable trait to automatically upload images and files with minimum configuration

0.1.8(6y ago)286.4k7MITPHP

Since Sep 30Pushed 5y ago3 watchersCompare

[ Source](https://github.com/TiagoSilvaPereira/Laravel-Uploadable)[ Packagist](https://packagist.org/packages/kingofcode/laravel-uploadable)[ RSS](/packages/kingofcode-laravel-uploadable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (1)Versions (8)Used By (0)

Laravel-Uploadable
==================

[](#laravel-uploadable)

Laravel Uploadable trait to automatically upload images and files with minimum configuration.

Introduction
------------

[](#introduction)

This package can help you to easily make uploads, using only one field in the database, and some simple attributes in your model class. With the default configuration, the package makes thumb, medium and normal image uploads. It can be used for other files upload too, like PDF, etc.

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

[](#installation)

```
composer require kingofcode/laravel-uploadable

```

This package includes [Intervention Image](http://image.intervention.io/) to resize and manage the images.

**For Laravel version less than 5.8.10, please use 0.1.7 version, as 0.1.8 added model replication that is supported only for Laravel &gt; 5.8.10**

About Upload
------------

[](#about-upload)

This package uses the [Laravel File Storage](https://laravel.com/docs/5.5/filesystem) to keep the file management. The files will be stored inside the default disk. For example, if you are using the public disk, to access the images or files, you need to create a symbolic link inside your project:

```
php artisan storage:link

```

And then, configure your default filesystem, inside config/filesystems.php to point the public disk:

```
'default' => env('FILESYSTEM_DRIVER', 'public'),

```

Usage
-----

[](#usage)

To use this package, import the Uploadable trait in your model:

```
use KingOfCode\Upload\Uploadable;
```

And then, configure your uploadable fields for images and files inside your model.

```
class Product extends Model
{
    use Uploadable;

    protected $fillable = [
        'name',
        'type',
        // Avoid adding file fields in the fillable array, it can break the correct upload
    ];

    // Array of uploadable images. These fields need to be existent in your database table
    protected $uploadableImages = [
        'image',
        'perfil_image',
        'test_image'
    ];

    // Array of uploadable files. These fields need to be existent in your database table
    protected $uploadableFiles = [
        'pdf'
    ];

}
```

That's all! After this configuration, you can send file data from the client side with the same name of each file field of the model. The package will make the magic!

Change Image Upload Size
------------------------

[](#change-image-upload-size)

The default sizes (width) for images are:

- thumb - 100px
- medium - 300px
- normal - Image width

You can modify these values directly in the $uploadableImages array. The accepted values are: **image\_width** or a number specifying the quantity of pixels.

```
protected $uploadableImages = [
  'image' => ['thumb' => 150, 'medium' => 500, 'normal' => 700],
  'perfil_image' => ['thumb' => 120, 'medium' => 'image_width', normal => 2000],
  'test_image'
];
```

Change Image Upload Types
-------------------------

[](#change-image-upload-types)

By default, this package saves **thumb**, **medium** and **normal** images. To disable some upload type, add this array to your model:

```
protected $imageResizeTypes = [
  'medium' => false,
  // ... You can disable medium and normal images upload too
];
```

Setting the upload folder name
------------------------------

[](#setting-the-upload-folder-name)

The upload will be made inside a specific folder with the name of the model, but in the plural mode. Eg: for the **Product** model, the images will be uploaded to the 'images/products' directory, and the other files, inside 'files/products'. If you want to modify this directory, add this code to your model:

```
public $uploadFolderName = 'products'; // Name of your folder
```

Getting the File Path inside Views, etc
---------------------------------------

[](#getting-the-file-path-inside-views-etc)

To get an image file path, you can call **getImagePath($imageField, $type)** from your object. Eg:

```
$product = Product::find(1);

$normal_image = $product->getImagePath('image');
$thumb_image = $product->getImagePath('image', 'thumb');
$medium_perfil_image = $product->getImagePath('perfil_image', 'medium');
```

And to get a simple file path, call **getFilePath($fileField)**:

```
$product = Product::find(1);

$pdf = $product->getFilePath('pdf');
```

Inspiration
-----------

[](#inspiration)

The basic structure of this package is inspired in the [Laravel Auto Upload](https://github.com/dees040/laravel-auto-upload) package

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

[](#contributing)

Feel free to comment, open issues and send PR's. Enjoy it!!

License
-------

[](#license)

MIT

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity58

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

Every ~152 days

Recently: every ~229 days

Total

7

Last Release

2238d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4d32a8a599b802e91a8c3a95f6428d6d9d8cacc1b0a30dda1a16d7eadf25030b?d=identicon)[TiagoRodrigues](/maintainers/TiagoRodrigues)

---

Top Contributors

[![TiagoSilvaPereira](https://avatars.githubusercontent.com/u/11933789?v=4)](https://github.com/TiagoSilvaPereira "TiagoSilvaPereira (21 commits)")

---

Tags

laraveluploadableuploadfile-uploadImage uploadauto-upload

### Embed Badge

![Health badge](/badges/kingofcode-laravel-uploadable/health.svg)

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

###  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)[coffeecode/uploader

It is a easy PHP upload manager for images, files and media in your application

17149.7k3](/packages/coffeecode-uploader)[itskodinger/midia

Simple Media manager for your Laravel project

1415.8k](/packages/itskodinger-midia)

PHPackages © 2026

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