PHPackages                             zeroar/withfile - 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. zeroar/withfile

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

zeroar/withfile
===============

A File extensions for Laravel Livewire.

v1.0(6y ago)021MITPHPPHP ^7.1.3

Since May 3Pushed 6y ago1 watchersCompare

[ Source](https://github.com/zeroar/withfile)[ Packagist](https://packagist.org/packages/zeroar/withfile)[ RSS](/packages/zeroar-withfile/feed)WikiDiscussions master Synced 6d ago

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

Livewire Uploading File
=======================

[](#livewire-uploading-file)

[![Latest Stable Version](https://camo.githubusercontent.com/40d7f3d3806b8de57644174af2beaa42b1451752a5ea924c1291363f16a6a1ba/68747470733a2f2f706f7365722e707567782e6f72672f7a65726f61722f7769746866696c652f762f737461626c65)](https://packagist.org/packages/zeroar/withfile)[![Total Downloads](https://camo.githubusercontent.com/b5b8933861b921da12a9a6b13a9dccce2b09a2133acb45ad7268e2e398ef3286/68747470733a2f2f706f7365722e707567782e6f72672f7a65726f61722f7769746866696c652f646f776e6c6f616473)](https://packagist.org/packages/zeroar/withfile)[![License](https://camo.githubusercontent.com/e7e67774d11df0bc9142cf9ac538c2bdcd5f9013bc1f1f4b6424c4c81ff98fa8/68747470733a2f2f706f7365722e707567782e6f72672f7a65726f61722f7769746866696c652f6c6963656e7365)](https://packagist.org/packages/zeroar/withfile)

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

[](#introduction)

Do you have a problem for uploading file in livewire component? If yes, same with me. If you use input with type file and implement `wire:model`, is that work for you to upload file? thats not work for now. Why this is happen? because livewire is send json data, not form data. I don't know this problem will gone in livewire future version. I research the solution for this problem and i found the solution for now. With this extensions, i hope this extensions will answer the problem.

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

[](#installation)

Install this using composer.

```
composer require zeroar/withfile

```

After you install, update your layouts and add `@withfileScripts` after `@livewireScripts`.

```
    ...

    @livewireScripts
    @withfileScripts

```

Implementation Component
------------------------

[](#implementation-component)

Now you can add this extension in your livewire component. To implement this, see the example below:

```
namespace App\Http\Livewire;

use Illuminate\Support\Facades\Storage;
use Livewire\Component;
use Withfile\WithFile; // add this to implement

class UploadPhoto extends Component
{
use WithFile; // add this to implement
// this is target variable
// this variable will turn to array after upload file
public $photo;

    // please implement this variable and add the variable target
    // if you not implement this, WithFile will not working
    public $fileable = [
        'photo'
    ];

    public function render() {
        return view('livewire.upload-photo');
    }

    // implement this method to edit or save the file
    public function updatedPhoto($value, $old_value)
    {
        // in this area, you can implement what you want for the file.
        // to save the file, i recommend to try this for save file in local

        $filename = $value['name'];
        // below for customize filename
        // $filename = "custom-file-name" . $value['extension'];
        Storage::disk('public')->put($filename, $this->raw($value));

        $this->photo = Storage::url($filename); // get the file url for saving to your database
    }
}
```

#### $fileable

[](#fileable)

This property is required. If you not implement this, your upload file will not working. So please implement this to your component.

#### updatedFoo($value, $old\_value)

[](#updatedfoovalue-old_value)

Updated method is same with livewire lifecycle hooks. But in livewire just only have one $value, in this i have add the $old\_value.

Implementation in view
----------------------

[](#implementation-in-view)

In your blade file, you can implement looks like example below:

```

  @isset($photo)

  @endisset

  Upload Photo

```

Or if you want to resize your image before send the file, below is example for this:

```

  @isset($photo)

  @endisset

  Upload Photo

```

Or if you want to resize both of width and height, below is example for this:

```

  @isset($photo)

  @endisset

  Upload Photo

```

#### wire:withfile

[](#wirewithfile)

Use this attribute looks like you use `wire:model`, but it's not same with `wire:model`. So, all in `wire:model` can't implemented to `wire:withfile`.

#### with-resize-if-image

[](#with-resize-if-image)

This is will resize your file if you upload an image. Before file image send to your component, image will resized.

#### with-max-both

[](#with-max-both)

This will add the maximum of width and height. In example, if height greater than width then the height will be set to maximum and width will automatically resized.

#### with-max-width, with-max-height

[](#with-max-width-with-max-height)

Use this if you wan't to resize just height or width for the maximum of image width or height.

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

2205d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e708310b1394a32204bf112b7d939594f87444201897fd7b4ffd6f47fe229d5?d=identicon)[moonlandsoft](/maintainers/moonlandsoft)

---

Top Contributors

[![avarik-anam](https://avatars.githubusercontent.com/u/4997579?v=4)](https://github.com/avarik-anam "avarik-anam (3 commits)")

### Embed Badge

![Health badge](/badges/zeroar-withfile/health.svg)

```
[![Health](https://phpackages.com/badges/zeroar-withfile/health.svg)](https://phpackages.com/packages/zeroar-withfile)
```

###  Alternatives

[spatie/livewire-filepond

Upload files using Filepond in Livewire components

306452.7k3](/packages/spatie-livewire-filepond)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)[namu/wirechat

A Laravel Livewire messaging app for teams with private chats and group conversations.

54324.5k](/packages/namu-wirechat)

PHPackages © 2026

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