PHPackages                             dillingham/interacts-with-uploads - 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. dillingham/interacts-with-uploads

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

dillingham/interacts-with-uploads
=================================

Adds upload to request object

1.0.0(5y ago)313[1 issues](https://github.com/dillingham/interacts-with-uploads/issues)MITHTML

Since Apr 15Pushed 5y agoCompare

[ Source](https://github.com/dillingham/interacts-with-uploads)[ Packagist](https://packagist.org/packages/dillingham/interacts-with-uploads)[ RSS](/packages/dillingham-interacts-with-uploads/feed)WikiDiscussions main Synced 3d ago

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

InteractsWithUploads
--------------------

[](#interactswithuploads)

Laravel trait adds FormRequest upload

 [ ![Build Status](https://github.com/dillingham/interacts-with-uploads/workflows/tests/badge.svg) ](https://github.com/dillingham/interacts-with-uploads/actions) [ ![Latest Stable Version](https://camo.githubusercontent.com/2c7434bc891bda3e55dc42a46283202a1d22f8d1a09f063864f03e881b36a416/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64696c6c696e6768616d2f696e746572616374732d776974682d75706c6f616473) ](https://packagist.org/packages/dillingham/interacts-with-uploads) [ ![Total Downloads](https://camo.githubusercontent.com/407262724d0f9d1ad1860f8d214ce6c10326a4951ec3a7919246a31e960d398c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f64696c6c696e6768616d2f696e746572616374732d776974682d75706c6f616473) ](https://packagist.org/packages/dillingham/interacts-with-uploads) [ ![twitter](https://camo.githubusercontent.com/4d611bda2f6e8730161339d887cbe17afe7f160bfde2eeb1baaf7cc40dd65071/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f696d5f627269616e5f643f636f6c6f723d253233316461316631266c6162656c3d54776974746572266c6f676f3d253233316461316631266c6f676f436f6c6f723d253233316461316631267374796c653d666c61742d737175617265) ](https://twitter.com/im_brian_d)

Install
-------

[](#install)

```
composer require dillingham/interacts-with-uploads

```

And add the following trait to your FormRequest classes

```
use \Dillingham\InteractsWithUploads;
```

Now you can call the following methods in controllers:

---

### New uploads

[](#new-uploads)

```
$request->upload('key')

```

```
public function store(CreateProfileRequest $request)
{
    $request->upload('banner');

    $profile = Profile::create($request->validated());

    return redirect()->route('profiles.show', $profile);
}
```

Store the file and add it's path to `validated()` for the same key: `banner`

This makes `$profile->banner` equal to `/uploads/asfos8asfoafaf9q3wf.jpg`

---

### Update uploads

[](#update-uploads)

```
$request->upload('binding.key')

```

```
public function update(UpdateProfileRequest $request, Profile $profile)
{
    $request->upload('profile.banner');

    $profile->update($request->validated());

    return redirect()->route('profiles.show', $profile);
}
```

If the request has a new file for `key`, it deletes the old and uploads the new

If no new file is in the request, it will add the original file path back to `validated()`

So submitting `null` for that `key` will result in the same path / no changes to the model.

It will get the original file path using the `key` &amp; [route model binding](https://laravel.com/docs/routing#route-model-binding), in this scenario.. `profile`

The binding `profile` connects a typehinted model &amp; defined in `Route::` using `{binding}` syntax

---

### Manual update

[](#manual-update)

If you are not using route model binding, you can manually set the path to update.

```
public function update(UpdateProfileRequest $request, Profile $profile)
{
    $request->updateUpload($profile, 'banner');

    $profile->update($request->validated());

    return redirect()->route('profiles.show', $profile);
}
```

Parameters
----------

[](#parameters)

You can specify a few options and override the defaults.

```
$request->upload('banner', 'uploads', 'public');
```

- `uploads`: is the default path within storage
- `public`: is the default disk within config/filesystems

### Author

[](#author)

[@im\_brian\_d](https://twitter.com/im_brian_d)

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance13

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community6

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

1854d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29180903?v=4)[Brian](/maintainers/dillingham)[@dillingham](https://github.com/dillingham)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/dillingham-interacts-with-uploads/health.svg)

```
[![Health](https://phpackages.com/badges/dillingham-interacts-with-uploads/health.svg)](https://phpackages.com/packages/dillingham-interacts-with-uploads)
```

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

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

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

PHPackages © 2026

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