PHPackages                             backstage/filament-uploadcare-field - 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. backstage/filament-uploadcare-field

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

backstage/filament-uploadcare-field
===================================

Uploadcare FileUpload component for Filament Forms

v4.0.1(2mo ago)35.2k[2 PRs](https://github.com/backstagephp/filament-uploadcare-field/pulls)1MITJavaScriptPHP ^8.1|^8.2|^8.3CI passing

Since Feb 21Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/backstagephp/filament-uploadcare-field)[ Packagist](https://packagist.org/packages/backstage/filament-uploadcare-field)[ Docs](https://github.com/backstagephp/filament-uploadcare-field)[ GitHub Sponsors](https://github.com/vormkracht10)[ RSS](/packages/backstage-filament-uploadcare-field/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (20)Versions (287)Used By (1)

Uploadcare FileUpload component for Filament Forms
==================================================

[](#uploadcare-fileupload-component-for-filament-forms)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d338f7ba84d167137d1160942448b79f8c0a30da3d466a8c8a46002be721f4f1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6261636b73746167652f66696c616d656e742d75706c6f6164636172652d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/backstage/filament-uploadcare-field)[![GitHub Tests Action Status](https://camo.githubusercontent.com/f3fa9b51bc88f993f7a4160ac4a997eb1c532d98f17cef8235a70935be5abf17/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6261636b73746167652f66696c616d656e742d75706c6f6164636172652d6669656c642f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/backstagephp/filament-uploadcare-field/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/ac5720ad1e1ba2dd3d24536168bb82eb553cc698d54d8eb3a913f335a6d3d9dd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6261636b73746167652f66696c616d656e742d75706c6f6164636172652d6669656c642f6669782d7068702d636f64652d7374796c696e672e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/backstagephp/filament-uploadcare-field/actions?query=workflow%3A%22Fix+PHP+code+styling%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/1f5f3c63507bc75544c6d0dbbdffbe829530c2bcaa45f7fbc511b0af6fc4d50e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6261636b73746167652f66696c616d656e742d75706c6f6164636172652d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/backstage/filament-uploadcare-field)

Nice to meet you, we're [Vormkracht10](https://vormkracht10.nl)
---------------------------------------------------------------

[](#nice-to-meet-you-were-vormkracht10)

Hi! We are a web development agency from Nijmegen in the Netherlands and we use Laravel for everything: advanced websites with a lot of bells and whitles and large web applications.

About the package
-----------------

[](#about-the-package)

This package provides a FileUpload component for Filament Forms that integrates with [Uploadcare](https://uploadcare.com) for file storage. It offers a flexible and customizable file upload experience with support for multiple files, image-only uploads, and metadata handling.

### Our other Uploadcare related packages

[](#our-other-uploadcare-related-packages)

- [PHP Uploadcare Transformations](https://github.com/vormkracht10/php-uploadcare-transformations)
- [Flysystem Uploadcare](https://github.com/vormkracht10/flysystem-uploadcare)

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

[](#installation)

You can install the package via composer:

```
composer require backstage/filament-uploadcare-field
```

Then you need to add the Uploadcare public key to your `services.php` config file:

```
return [
    'uploadcare' => [
        'public_key' => env('UPLOADCARE_PUBLIC_KEY')
    ]
];
```

Warning

Do not use the Flysystem Uploadcare driver with Filament, as it may cause unexpected deletion of files. This component uses the Javascript Uploadcare widget independently of the filesystem driver.

### Casting attributes

[](#casting-attributes)

While Filament typically recommends using an `array` cast for file upload fields, this package requires a different approach. Since the Uploadcare component handles JSON parsing internally, you should **not** add an `array` cast to your Eloquent model properties. This prevents double JSON encoding, which would make the data more difficult to work with in your application.

### Customization

[](#customization)

If you want to customize the view used by the component, you can publish the views:

```
php artisan vendor:publish --tag="filament-uploadcare-field-views"
```

Basic Usage
-----------

[](#basic-usage)

```
use Backstage\Uploadcare\Forms\Components\Uploadcare;
use Backstage\Uploadcare\Enums\Style;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            Uploadcare::make('images')
                ->label('Images'),
        ]);
}
```

Available Methods
-----------------

[](#available-methods)

### Configuration Methods

[](#configuration-methods)

#### `publicKey(string $publicKey)`

[](#publickeystring-publickey)

Set a custom public key for Uploadcare:

```
Uploadcare::make('images')
    ->publicKey('your-custom-key');
```

#### `cdnCname(string $cdnCname)`

[](#cdncnamestring-cdncname)

Set a custom CDN CNAME for serving files (default is ''):

```
Uploadcare::make('images')
    ->cdnCname('https://your-custom-cdn.com');
```

#### `dbCdnCname(string $dbCdnCname)`

[](#dbcdncnamestring-dbcdncname)

Set a custom CDN CNAME for storing URLs in your database. This allows you to bypass CDN limitations by transforming URLs when saving to and retrieving from the database:

```
Uploadcare::make('images')
    ->dbCdnCname('https://your-custom-cdn.com');
```

When this option is set, the component will:

1. Transform URLs from '' to your custom domain when saving to the database
2. Transform URLs from your custom domain back to '' when loading data for the uploader widget

This is particularly useful when you need to use your own domain for serving files while maintaining compatibility with Uploadcare's system.

#### `uploaderStyle(Style $style)`

[](#uploaderstylestyle-style)

Set the uploader style (default is `Style::INLINE`):

```
Uploadcare::make('images')
    ->uploaderStyle(Style::INLINE);
```

### File Upload Options

[](#file-upload-options)

#### `multiple(bool $multiple = true, int $min = 0, int $max = 0)`

[](#multiplebool-multiple--true-int-min--0-int-max--0)

Enable multiple file uploads with optional min/max constraints:

```
Uploadcare::make('images')
    ->multiple(true, 2, 5); // Allow 2-5 files
```

#### `imagesOnly(bool $imgOnly = true)`

[](#imagesonlybool-imgonly--true)

Restrict uploads to image files only:

```
Uploadcare::make('images')
    ->imagesOnly();
```

#### `image(bool $image = true)`

[](#imagebool-image--true)

Alias for `imagesOnly()`:

```
Uploadcare::make('images')
    ->image(); // Same as ->imagesOnly()
```

#### `accept(array|string $accept)` (deprecated)

[](#acceptarraystring-accept-deprecated)

Specify allowed file types:

```
Uploadcare::make('documents')
    ->accept(['image/*', 'application/pdf']);
```

#### `acceptedFileTypes(array|string $acceptedFileTypes)` (replaces `accept`)

[](#acceptedfiletypesarraystring-acceptedfiletypes-replaces-accept)

Specify allowed file types:

```
Uploadcare::make('documents')
    ->accept(['image/*', 'application/pdf']);
```

#### `sourceList(array|string $sourceList)`

[](#sourcelistarraystring-sourcelist)

Configure upload sources:

```
Uploadcare::make('images')
    ->sourceList(['local', 'url', 'camera', 'dropbox']);
```

#### `maxLocalFileSizeBytes(int $bytes)`

[](#maxlocalfilesizebytesint-bytes)

Set the maximum file size for local uploads in bytes (default is 500MB):

```
Uploadcare::make('images')
    ->maxLocalFileSizeBytes(524288000); // 500MB
```

#### `maxLocalFileSize(string $size)`

[](#maxlocalfilesizestring-size)

Set the maximum file size for local uploads using human-readable format:

```
Uploadcare::make('images')
    ->maxLocalFileSize('10MB'); // Supports B, KB, MB, GB, TB
```

#### `cropPreset(string|array $preset)`

[](#croppresetstringarray-preset)

Set the crop aspect ratio(s) for images. Accepts a single preset, comma-separated string, or array of presets. Each preset should be in format "width:height" (e.g., "1:1" for square, "16:9" for widescreen), "free" for unconstrained cropping, or an empty string to disable cropping. Decimal values are supported (e.g., "1.91:1"):

```
// Single preset
Uploadcare::make('images')
    ->cropPreset('1:1'); // Square crop only

// Multiple presets (comma-separated string)
Uploadcare::make('images')
    ->cropPreset('free, 1:1, 16:9'); // Free, square, or widescreen

// Multiple presets (array)
Uploadcare::make('images')
    ->cropPreset(['free', '1:1', '16:9', '4:3']);

// Free crop only
Uploadcare::make('images')
    ->cropPreset('free');

// Disable cropping
Uploadcare::make('images')
    ->cropPreset('');
```

#### `imageEditorAspectRatios(string|array $aspectRatios)`

[](#imageeditoraspectratiosstringarray-aspectratios)

Alias for `cropPreset()` to maintain compatibility with Filament's default FileUpload field:

```
Uploadcare::make('images')
    ->imageEditorAspectRatios(['1:1', '16:9', '4:3']);
```

#### `removeCopyright(bool $remove = true)`

[](#removecopyrightbool-remove--true)

Remove the Uploadcare copyright from the uploader interface. This feature is available on some paid plans:

```
Uploadcare::make('images')
    ->removeCopyright(); // Remove copyright
```

### Metadata Handling

[](#metadata-handling)

#### `withMetadata(bool $withMetadata = true)`

[](#withmetadatabool-withmetadata--true)

Include file metadata in the form data:

```
Uploadcare::make('images')
    ->withMetadata();
```

To handle the metadata in your form:

```
class EditContent extends EditRecord
{
    protected static string $resource = ContentResource::class;

    protected function mutateFormDataBeforeSave(array $data): array
    {
        if (isset($data['images'])) {
            // Access metadata through $data['images']
            // Process metadata as needed
        }

        return $data;
    }
}
```

Complete Example
----------------

[](#complete-example)

Here's a comprehensive example showcasing multiple features:

```
use Backstage\Uploadcare\Forms\Components\Uploadcare;
use Backstage\Uploadcare\Enums\Style;

public static function form(Form $form): Form
{
    return $form
        ->schema([
            Uploadcare::make('documents')
                ->label('Documents')
                ->uploaderStyle(Style::INLINE)
                ->multiple(true, 1, 5)
                ->accept(['application/pdf', 'image/*'])
                ->sourceList(['local', 'url'])
                ->withMetadata()
                ->columnSpanFull(),
        ]);
}
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

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

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Baspa](https://github.com/vormkracht10)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance91

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~1 days

Total

230

Last Release

60d ago

Major Versions

v1.1.52 → v2.0.0-beta152026-01-12

v1.1.53 → v2.0.0-beta192026-01-13

v1.1.54 → v2.0.0-beta362026-01-21

v2.0.27 → v4.0.02026-03-13

v2.0.26 → 4.x-dev2026-03-13

PHP version history (3 changes)v0.1.0PHP ^8.2

v0.2.8PHP ^8.1|^8.2

v0.3.0PHP ^8.1|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/7c6a425dc8645907a118a007438172d58c2016773f54ab3a834beff172632f13?d=identicon)[ux](/maintainers/ux)

---

Top Contributors

[![Baspa](https://avatars.githubusercontent.com/u/10845460?v=4)](https://github.com/Baspa "Baspa (5 commits)")[![Casmo](https://avatars.githubusercontent.com/u/385764?v=4)](https://github.com/Casmo "Casmo (4 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravelbackstagefilament-uploadcare-field

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/backstage-filament-uploadcare-field/health.svg)

```
[![Health](https://phpackages.com/badges/backstage-filament-uploadcare-field/health.svg)](https://phpackages.com/packages/backstage-filament-uploadcare-field)
```

###  Alternatives

[spatie/livewire-filepond

Upload files using Filepond in Livewire components

306452.7k3](/packages/spatie-livewire-filepond)[mwguerra/filemanager

A full-featured file manager package for Laravel and Filament v5 with dual operating modes, drag-and-drop uploads, S3/MinIO support, and comprehensive security features.

718.5k1](/packages/mwguerra-filemanager)[elegantly/laravel-invoices

Store invoices safely in your Laravel application

23131.8k](/packages/elegantly-laravel-invoices)[schmeits/filament-character-counter

This is a Filament character counter TextField and Textarea form field for Filament v4 and v5

33184.7k6](/packages/schmeits-filament-character-counter)[eightynine/filament-excel-import

Import Excel files with Laravel Filament.

94167.0k1](/packages/eightynine-filament-excel-import)[defstudio/filament-searchable-input

A searchable autocomplete input for Filament forms

3212.4k](/packages/defstudio-filament-searchable-input)

PHPackages © 2026

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