Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

earmsby's avatar

file upload field on Filament form

This is a combination Filament and server/php question.

I have a file upload field on a Filament form with this set up:

FileUpload::make('pdf_file')
                            ->disk('public')
                            ->directory('music_pdfs')
                            ->maxSize(20000)
                            ->visibility('public'),

In the PHP ini file on the server where this Filament project runs I have set the values:

post_max_size = 20M
upload_max_filesize = 20M

When I try to upload a file with a size of 4.8M it fails. Is there some other value that needs to be increased? What am I missing?

0 likes
4 replies
LaryAI's avatar
Level 58

You're on the right track by increasing post_max_size and upload_max_filesize in your php.ini, but there are a few other things to check that could cause file uploads to fail, even at sizes well below your set limits:

  1. Check for client_max_body_size (Nginx only):

If your server is running Nginx, it has its own limit that can block large uploads, regardless of PHP settings. Make sure your nginx.conf or site config includes:

client_max_body_size 20M;

Reload/restart Nginx if you change this.

  1. Check memory_limit in php.ini:

Sometimes, PHP's memory_limit may prevent large files from being processed. Try increasing it to at least the size of your largest file, e.g.:

memory_limit = 128M

Or higher, if needed.

  1. Check max_file_uploads in php.ini:

While less likely to affect single uploads, ensure this value is sufficient (default is 20):

max_file_uploads = 20
  1. Clear Browser/Server Cache:

Sometimes errors or restrictions may be cached. Try clearing your browser cache and restarting your webserver.

  1. Double-Check Filament Validation (maxSize):

Your code:

FileUpload::make('pdf_file')
    ->disk('public')
    ->directory('music_pdfs')
    ->maxSize(20000)
    ->visibility('public'),

Filament's maxSize uses kilobytes. 20000 means ~20MB, which is correct. But consider lowering it for testing (e.g., 6000) to see whether validation fires before PHP-level limits.

  1. Check Storage Permissions:

Make sure your storage/app/public/music_pdfs directory is writable by your web server process.

  1. Debugging:

Enable PHP error reporting in your .env:

APP_DEBUG=true

Check your logs (typically in storage/logs/laravel.log) for any clues.


Summary Checklist:

  • post_max_size (>= file size)
  • upload_max_filesize (>= file size)
  • memory_limit (>= file size)
  • client_max_body_size (Nginx, if used)
  • max_file_uploads
  • Storage directory permissions
  • Server and browser cache cleared

Check each of these areas, and your uploads should work for files up to your set limits. If you’re still having trouble, let us know what server stack you’re using (Apache/Nginx) and share any error messages you see!

earmsby's avatar

The app is running on a Forge server. I don't think that uses Apache. I'm not seeing any way to restart the server in the Forge interface but can search for a way to do that to see if it helps.

I checked all the values listed above and all are at or higher than 20MB. I can upload files smaller than 4MB. So, there seems to be some setting stuck at 4MB but I don't see it in phpinfo().

earmsby's avatar

I increased the values in the php ini file to 120M and increased the value of the Filament field to 200000.

Now, I can upload some bigger files. But uploading a file that is 12.8M I get an error:

The data.pdf_file.f648803e-4e14-4f09-abb4-b18892cb1d9a field must not be greater than 12288 kilobytes.

I cannot figure out where this limit is set. The only thing I haven't eliminated is the client_max_body_size (Nginx) because I'm not sure where to look for that.

earmsby's avatar

I solved it!! It was a limitation in LiveWire. In case anyone else runs into this, here's what I did:

  1. Published the LiveWire config with php artisan livewire:publish --config
  2. In config/livewire.php changed this:
'rules' => null

to this:

'rules' => 'file|max:20000'

Pushed that to my Forge site and voila, now I can upload files up to 20MB.

Please or to participate in this conversation.