Pdf file upload doesn't save path in database, image does

Forms\Components\FileUpload::make('file')
->required()
->disk('local')
Forms\Components\FileUpload::make('file')
->required()
->disk('local')
Uploading an image using above component works as expected (see attachment 1) Uploading a pdf using above component results in a db error because file attribute can not be null (see attachment 2). Am I having the wrong expectations here or doing something wrong?
5 Replies
Magooh
MagoohOP2y ago
Magooh
MagoohOP2y ago
It looks like there's something wrong with the pdf. Trying a different pdf file works like expected Looks like it's because of a long file name
Dan Harrin
Dan Harrin2y ago
how long?
Magooh
MagoohOP2y ago
APznzaZVZmdRSnvodJptCwMsH7LYi3C91fSDX0i6PyNC-ComLcOHKa847B4v6Tk6UppzcmeIlryvctrG0xJD5b6uYUvp_hpe33j8W-XWJQs5ru01py3jlNXFxd8E2ZFfBL0WVriuquC7J_zaLxbiCblA50apOaoTOR3D3MA8PNS1x7ckbtlBWG61MuiLKBsq5ksJlubcMQi7cMmDK_VqYyvh89lVZFJqMM_G-LTJ6C9hdagE.pdf
APznzaZVZmdRSnvodJptCwMsH7LYi3C91fSDX0i6PyNC-ComLcOHKa847B4v6Tk6UppzcmeIlryvctrG0xJD5b6uYUvp_hpe33j8W-XWJQs5ru01py3jlNXFxd8E2ZFfBL0WVriuquC7J_zaLxbiCblA50apOaoTOR3D3MA8PNS1x7ckbtlBWG61MuiLKBsq5ksJlubcMQi7cMmDK_VqYyvh89lVZFJqMM_G-LTJ6C9hdagE.pdf
= 244 chars long
Proculair B.V.
It might add some complexity but adding https://filamentphp.com/docs/2.x/spatie-laravel-media-library-plugin/installation and https://spatie.be/docs/laravel-medialibrary/v10/introduction will give you some really handy features. It might also solve your problem.
Filament
Installation - Spatie Media Library Plugin - Filament
A plugin to add support for spatie/laravel-medialibrary to Filament.
Want results from more Discord servers?
Add your server