PHPackages                             jhonoryza/laravel-fileupload-component - 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. jhonoryza/laravel-fileupload-component

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

jhonoryza/laravel-fileupload-component
======================================

file upload component

1.0.0(2y ago)8111MITPHPPHP ^8.2

Since Jan 25Pushed 2y ago1 watchersCompare

[ Source](https://github.com/jhonoryza/laravel-fileupload-component)[ Packagist](https://packagist.org/packages/jhonoryza/laravel-fileupload-component)[ RSS](/packages/jhonoryza-laravel-fileupload-component/feed)WikiDiscussions main Synced 3d ago

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

Laravel File Upload Component
=============================

[](#laravel-file-upload-component)

 [ ![Total Downloads](https://camo.githubusercontent.com/f902d5c525878bee183e47a2b642e80003a3032b6ebfa120963df0c649c376fd/68747470733a2f2f706f7365722e707567782e6f72672f6a686f6e6f72797a612f6c61726176656c2d66696c6575706c6f61642d636f6d706f6e656e742f642f746f74616c2e737667) ](https://packagist.org/packages/jhonoryza/laravel-fileupload-component) [ ![Latest Stable Version](https://camo.githubusercontent.com/67ccb03d74f6c69afcd1ab91d03d38258a5151bb9c9a7690794306e9205a20db/68747470733a2f2f706f7365722e707567782e6f72672f6a686f6e6f72797a612f6c61726176656c2d66696c6575706c6f61642d636f6d706f6e656e742f762f737461626c652e737667) ](https://packagist.org/packages/jhonoryza/laravel-fileupload-component) [ ![License](https://camo.githubusercontent.com/7f5dff16c3c89eae568f10cd30ab5801db9ae6ec16c7eb090e73ba5227b44148/68747470733a2f2f706f7365722e707567782e6f72672f6a686f6e6f72797a612f6c61726176656c2d66696c6575706c6f61642d636f6d706f6e656e742f6c6963656e73652e737667) ](https://packagist.org/packages/jhonoryza/laravel-fileupload-component)

laravel livewire file upload component

Requirement
-----------

[](#requirement)

- php v8.2
- laravel v10
- livewire v3
- spatie/media-library v10

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

[](#installation)

```
composer install jhonoryza/laravel-fileupload-component
```

```
php artisan vendor:publish --provider=Jhonoryza\Component\FileUpload\FileUploadServiceProvider
```

Quick Start
-----------

[](#quick-start)

prepare model, example Setting model

```
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\InteractsWithMedia;
use Jhonoryza\Component\FileUpload\Traits\InteractsWithFileUpload;

class Setting extends Model implements HasMedia
{
    use InteractsWithMedia;
    use InteractsWithFileUpload;

    public function registerMediaCollections() : void
    {
        $this->addMediaCollection('settings');
    }
}
```

prepare livewire form class

```
   /**
    * property to store multiple images
    */
    public $images = [];

   /**
    * listener when there is onFileReplace event from the component
    */
   #[On('images:onFileReplace')]
   public function replaceImages(array $images): void
   {
       $this->images = $images;
   }

   /**
    * listener when there is onFileAdded event from the component
    */
   #[On('images:onFileAdded')]
   public function addToImages(array $file): void
   {
       $this->images[$file['uuid']] = $file;
   }

   /**
    * form save function example, setting is a Model
    * we call syncFileUploadRequest function
    * to save images to media library
    */
    public function save()
    {
        $this->setting
            ->syncFileUploadRequest($this->images)
            ->toMediaCollection('settings');
    }
```

in create or edit livewire component

```

```

in view livewire component

```

```

Property Explanation
--------------------

[](#property-explanation)

- name is required and will affect what the event name is
- :model you need to pass a variable with Model type that implement HasMedia
- collection is for media collection name
- :multiple for single file upload or multiple file upload
- :canUploadFile to hide file selector

Component Event
---------------

[](#component-event)

this component dispatch 2 event when temporary upload is started

- media:temporary-upload-started
- media:temporary-upload-finished

change `media` with the `name` property, example `name` property is images

```

        Update Setting

```

or you can listen to default livewire file upload event like this

```

        Update Setting

```

another 2 event when the file is removed / loaded or added

- media:onFileReplace
- media:onFileAdded

change `media` with the `name` property, example `name` property is images

```
   #[On('images:onFileReplace')]
   public function replaceImages(array $images): void
   {
       $this->images = $images;
   }

   #[On('images:onFileAdded')]
   public function addToImages(array $file): void
   {
       $this->images[$file['uuid']] = $file;
   }
```

next thing todo
---------------

[](#next-thing-todo)

- test validation with error message
- add unit test
- bug when interacts with session flash after redirect (session flash data is missing)

Security
--------

[](#security)

If you've found a bug regarding security please mail  instead of using the issue tracker.

License
-------

[](#license)

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

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

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

892d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

labkitalaravel-fileupload-component

### Embed Badge

![Health badge](/badges/jhonoryza-laravel-fileupload-component/health.svg)

```
[![Health](https://phpackages.com/badges/jhonoryza-laravel-fileupload-component/health.svg)](https://phpackages.com/packages/jhonoryza-laravel-fileupload-component)
```

###  Alternatives

[filament/spatie-laravel-media-library-plugin

Filament support for `spatie/laravel-medialibrary`.

1806.0M195](/packages/filament-spatie-laravel-media-library-plugin)[dmitrybubyakin/nova-medialibrary-field

Laravel Nova field for managing the Spatie media library.

270654.1k2](/packages/dmitrybubyakin-nova-medialibrary-field)[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[livewire-filemanager/filemanager

A simple, friendly and practical Livewire filemanager for your applications

36210.0k1](/packages/livewire-filemanager-filemanager)[ahmed-aliraqi/laravel-media-uploader

This package used to upload files using laravel-media-library

34125.4k3](/packages/ahmed-aliraqi-laravel-media-uploader)[slimani/filament-media-manager

A media manager plugin for Filament.

126.9k](/packages/slimani-filament-media-manager)

PHPackages © 2026

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