Filament Plugins

Purchase

File types

By default, the Media Library only accepts image uploads. However, you are free to allow more file types into your library using the below helpers.

The Media Library will show previews for those file types that it can generate previews for (such as images, and PDFs when using the "spatie/pdf-to-image" package). Other file types will show using a sensible icon.

Note that this only applies to new uploads. Any existing files that might not match the accepted types will still appear.

Images

By default, images are allowed to be uploaded. You can disable this by passing false to the ->acceptImage() method:

app/Providers/Filament/YourPanelProvider.php

$plugin->acceptImage(false)

To accept only a specific subset of image types, use ->acceptImage(false) and use the ->additionalAcceptedFileTypes() method below to enable these specific types.

PDFs

To enable PDF uploads, use the ->acceptPdf() method:

app/Providers/Filament/YourPanelProvider.php

$plugin->acceptPdf()

Note: In order to upload PDFs, you need to have the "spatie/pdf-to-image" package configured correctly. This package is already required via Composer if you are using Spatie Media Library, but you need to make sure that the extension for imagick has been installed and that Ghostscript is installed. Check out the requirements.

Videos

To enable video uploads, use the ->acceptVideo() method:

app/Providers/Filament/YourPanelProvider.php

$plugin->acceptVideo()

Note: In order to let your users upload videos, you need to have the FFmpeg binary installed. See the FFmpeg website for installation instructions. You also need to install the php-ffmpeg/php-ffmpeg package and update the value of the config media-library.ffmpeg_path and media-library.ffmpeg_probe.

Audio files

To enable audio file uploads, use the ->acceptAudio() method:

app/Providers/Filament/YourPanelProvider.php

$plugin->acceptAudio()

This accepts all audio types including .mp3, .wav, .flac and other common formats.

ZIP archives

To enable ZIP file uploads, use the ->acceptZip() method:

app/Providers/Filament/YourPanelProvider.php

$plugin->acceptZip()

This accepts both .zip files and other ZIP-compressed formats.

Microsoft Office documents

The Media Library provides convenient methods for accepting Microsoft Office documents:

Microsoft Word

To accept Word-documents (.doc and .docx), use the ->acceptMicrosoftWord() method:

app/Providers/Filament/YourPanelProvider.php

$plugin->acceptMicrosoftWord()

Microsoft PowerPoint

To accept PowerPoint-presentations (.ppt and .pptx), use the ->acceptMicrosoftPowerPoint() method:

app/Providers/Filament/YourPanelProvider.php

$plugin->acceptMicrosoftPowerPoint()

Microsoft Excel

To accept Excel-spreadsheets (.xls and .xlsx), use the ->acceptMicrosoftExcel() method:

app/Providers/Filament/YourPanelProvider.php

$plugin->acceptMicrosoftExcel()

CSV files

To enable CSV file uploads, use the ->acceptCsv() method:

app/Providers/Filament/YourPanelProvider.php

$plugin->acceptCsv()

Custom file types

For file types not covered by the built-in methods, you can specify additional accepted file types using MIME types:

Single file type

app/Providers/Filament/YourPanelProvider.php

$plugin->additionalAcceptedFileType('application/json')

Multiple file types

app/Providers/Filament/YourPanelProvider.php

$plugin->additionalAcceptedFileTypes([
    'application/json',
    'text/plain',
    'application/xml',
])

In all cases, the library will fall back to an icon for file types it cannot generate previews for.

© FilamentPlugins.com ✦ 2022 – 2025 ✦ All rights reserved.