© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•2y ago•
1 reply
Benson

Cannot upload PDF

I have the following component in a form

Forms\Components\FileUpload::make('resume_file_name')
    ->label('')
    ->image()
    ->acceptedFileTypes(['application/pdf'])
    ->maxSize(5000)
    ->columnSpanFull()
    ->required(),
Forms\Components\FileUpload::make('resume_file_name')
    ->label('')
    ->image()
    ->acceptedFileTypes(['application/pdf'])
    ->maxSize(5000)
    ->columnSpanFull()
    ->required(),


it's simple. All I need is for it to accept pdf files and upload on submit.

Whenever I select a pdf file, I get an error (attached). in the console it says
Failed to load resource: the server responded with a status of 422 (Unprocessable Content)
Failed to load resource: the server responded with a status of 422 (Unprocessable Content)

This only seems to happen for PDF files. I changed the component to image, and I was able to successfully upload a file.

What have I tried?


- published the livewire config and updated the
rules
rules
and set the
max_upload_time
max_upload_time


'temporary_file_upload' => [
    'disk' => null,        // Example: 'local', 's3'              | Default: 'default'
    'rules' => ['mimes:pdf,jpg,png', 'max:12288', 'file', 'required'],       // Example: ['file', 'mimes:png,jpg']  | Default: ['required', 'file', 'max:12288'] (12MB)
    'directory' => null,   // Example: 'tmp'                      | Default: 'livewire-tmp'
    'middleware' => null,  // Example: 'throttle:5,1'             | Default: 'throttle:60,1'
    'preview_mimes' => [   // Supported file types for temporary pre-signed file URLs...
        'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
        'mov', 'avi', 'wmv', 'mp3', 'm4a',
        'jpg', 'jpeg', 'mpga', 'webp', 'wma', 'pdf',
    ],
    // "rules" => "file|mimes:pdf|max:49152",
    'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated...
    'cleanup' => true, // Should cleanup temporary uploads older than 24 hrs...
],
'temporary_file_upload' => [
    'disk' => null,        // Example: 'local', 's3'              | Default: 'default'
    'rules' => ['mimes:pdf,jpg,png', 'max:12288', 'file', 'required'],       // Example: ['file', 'mimes:png,jpg']  | Default: ['required', 'file', 'max:12288'] (12MB)
    'directory' => null,   // Example: 'tmp'                      | Default: 'livewire-tmp'
    'middleware' => null,  // Example: 'throttle:5,1'             | Default: 'throttle:60,1'
    'preview_mimes' => [   // Supported file types for temporary pre-signed file URLs...
        'png', 'gif', 'bmp', 'svg', 'wav', 'mp4',
        'mov', 'avi', 'wmv', 'mp3', 'm4a',
        'jpg', 'jpeg', 'mpga', 'webp', 'wma', 'pdf',
    ],
    // "rules" => "file|mimes:pdf|max:49152",
    'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated...
    'cleanup' => true, // Should cleanup temporary uploads older than 24 hrs...
],


- modified the
php.ini
php.ini
config to include the following

upload_max_filesize=20M
post_max_size=20M
upload_max_filesize=20M
post_max_size=20M


- ChatGPT (😭)

Any aassistance would be greatly appreciated.
Screenshot_2024-06-29_at_6.55.34_AM.png
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

PDF Upload in RichEditor
FilamentFFilament / ❓┊help
4mo ago
SPATIE MEDIALIBRARY PDF FILE UPLOAD
FilamentFFilament / ❓┊help
2y ago
File Upload, PDF FILE ONLY. HOW?
FilamentFFilament / ❓┊help
2y ago