filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.61k stars 2.9k forks source link

FileUpload acceptedFileTypes audio check only mp3 #12961

Closed POMXARK closed 4 months ago

POMXARK commented 4 months ago

Package

filament/forms

Package Version

v3.2

Laravel Version

v11.0.9

Livewire Version

v3.5.0

PHP Version

PHP 8.2

Problem description

data types are not validated

Expected behavior

was waiting for the file to upload

Steps to reproduce

use GuzzleHttp\Psr7\MimeType;

 public static function form(Form $form): Form
    {
        $types = app(MimeType::class);

        $acceptedAudioTypes = [
            $types->fromExtension('mp3'),
            $types->fromExtension('wav'),
            $types->fromExtension('flac'),
        ];

        return $form
            ->schema([
                Forms\Components\FileUpload::make('audio')
                    ->acceptedFileTypes($acceptedAudioTypes)
                    ->helperText(new HtmlString('MP3, WAV, FLAC'))
            ]);
    }

Reproduction repository

https://github.com/POMXARK/filament_3_FileUpload_acceptedFileTypes

Relevant log output

No response

Donate 💰 to fund this issue

Fund with Polar

POMXARK commented 4 months ago

2024-05-30_19-54 2024-05-30_19-55

zepfietje commented 4 months ago

Have you tried passing the types as an array of strings?

POMXARK commented 4 months ago

Have you tried passing the types as an array of strings?

yes

zepfietje commented 4 months ago

Okay we need more info on what’s happening and what you’re expecting to happen. Please also check the actual mime of the file using the CLI.

zepfietje commented 4 months ago

I'm going to close this issue since we haven't heard back from the author.