Uploading File Gives [Method Not Allowed] error when uploaded via filepond

I am getting the following error when try to upload files via Filament. The GET method is not supported when for route Livewire/upload-file. I am working on it locally at the moment. I am using Laravel 11.x with Laragon. Serving from public folder. I am not using php artisan serve to serve app. File upload code:
# images
Forms\Components\FileUpload::make('images')
->label('Upload images of the recipe')
->helperText('Drag & drop multiple images at once')
// ->disk('public')
// ->visibility('public')
->reactive()
->acceptedFileTypes(['image/*'])
->multiple()
->maxSize(10240) # 10MB file limit
->maxFiles(5)
->minFiles(1)
->directory('recipe-images')
->saveRelationshipsUsing(function ($component, $state, $record) {
foreach ($state as $filePath) {
$record->images()->create([
'path' => $filePath
]);
}
})->columnSpanFull()
->required()
# images
Forms\Components\FileUpload::make('images')
->label('Upload images of the recipe')
->helperText('Drag & drop multiple images at once')
// ->disk('public')
// ->visibility('public')
->reactive()
->acceptedFileTypes(['image/*'])
->multiple()
->maxSize(10240) # 10MB file limit
->maxFiles(5)
->minFiles(1)
->directory('recipe-images')
->saveRelationshipsUsing(function ($component, $state, $record) {
foreach ($state as $filePath) {
$record->images()->create([
'path' => $filePath
]);
}
})->columnSpanFull()
->required()
No description
No description
26 Replies
cmdrpigeon
cmdrpigeonOP2d ago
Can somebody please guide me on resolving this issue? Thanks in advance! @Leandro Ferreira can you please help me?
LeandroFerreira
it looks ok. Maybe you could try the FileUpload field in another project or Filament fresh install to see if it happens
cmdrpigeon
cmdrpigeonOP2d ago
Thanks, let me try that I am using v^3.2.52. is that okay? or should i use another much stabler version.
LeandroFerreira
latest version
cmdrpigeon
cmdrpigeonOP2d ago
Thanks, installing new version...
cmdrpigeon
cmdrpigeonOP2d ago
Just installed new version using composer require filament/filament:"^3.2" -W Still same error
No description
cmdrpigeon
cmdrpigeonOP2d ago
composer.json
"require": {
"php": "^8.2",
"filament/filament": "^3.2",
"filament/forms": "^3.2",
"laravel/framework": "^11.31",
"laravel/tinker": "^2.9",
"livewire/livewire": "^3.5"
},
"require": {
"php": "^8.2",
"filament/filament": "^3.2",
"filament/forms": "^3.2",
"laravel/framework": "^11.31",
"laravel/tinker": "^2.9",
"livewire/livewire": "^3.5"
},
Dan Mason
Dan Mason2d ago
You should be getting a 405 error for invalid method, but seems you are getting a 500? Possibly getting a new error?
cmdrpigeon
cmdrpigeonOP2d ago
It's the same error as above shared.
No description
Dan Mason
Dan Mason2d ago
That isn't the error you are getting, in dev tools on the filament page inspect Network > Click on the erroring request > Response. Or check your storage/logs
cmdrpigeon
cmdrpigeonOP2d ago
let me check i cleared storage/logs tried to re-upload the image. this is what i am getting.
[2025-01-05 15:06:05] local.ERROR: Path must not be empty {"userId":1,"exception":"[object] (ValueError(code: 0): Path must not be empty at C:\\laragon\\www\\recipe\\vendor\\laravel\\framework\\src\\Illuminate\\Filesystem\\FilesystemAdapter.php:460)
[2025-01-05 15:06:05] local.ERROR: Path must not be empty {"userId":1,"exception":"[object] (ValueError(code: 0): Path must not be empty at C:\\laragon\\www\\recipe\\vendor\\laravel\\framework\\src\\Illuminate\\Filesystem\\FilesystemAdapter.php:460)
Dan Mason
Dan Mason2d ago
Is this using the local disk? I see the public lines were commented out Try specifying ->directory('example') on the field to see if it resolves it.
cmdrpigeon
cmdrpigeonOP2d ago
Thanks, let me try it. btw in .env file, the following config is set. FILESYSTEM_DISK=local
Dan Mason
Dan Mason2d ago
There is also a FILAMENT_FILESYSTEM_DISK which is also used in the filament.php config file if you have published that but I think that fallbacks to FILESYSTEM_DISK.
cmdrpigeon
cmdrpigeonOP2d ago
yup, i haven't set this FILAMENT_FILESYSTEM_DISK variable. let me try overriding FILESYSTEM_DISK setting it to public
Dan Mason
Dan Mason2d ago
Why would you need to do that? You can uncomment the disk lines on your field above if you want it in public
cmdrpigeon
cmdrpigeonOP2d ago
oh ok
Dan Mason
Dan Mason2d ago
Did you test with the directory method? If you are using the local disk then it should use this as the default root path unless you have changed it: https://github.com/laravel/laravel/blob/657070ea8a95ec269d0ed4c801cead04976a871a/config/filesystems.php#L35 The public disk will use this: https://github.com/laravel/laravel/blob/657070ea8a95ec269d0ed4c801cead04976a871a/config/filesystems.php#L42
cmdrpigeon
cmdrpigeonOP2d ago
yup, tested with directory() method. this is what i already did, in the my first message of this thread.
i haven't changed any defaults related to filesystem. local still points to app/private and public to app/public uncommented, still the same issue.
->disk('public')
->visibility('public')
->disk('public')
->visibility('public')
LeandroFerreira
Go to php.ini in your laragon and check upload_tmp_dir
Dan Mason
Dan Mason2d ago
Jynx 😅
LeandroFerreira
try to set a tmp directory like upload_tmp_dir = C:\laragon\tmp
cmdrpigeon
cmdrpigeonOP2d ago
Yup, it worked. upload_tmp_dir was empty and disabled. assigning and restarting server did the trick!
Dan Mason
Dan Mason2d ago
Nice 👍 Please mark as solved ✅
cmdrpigeon
cmdrpigeonOP2d ago
Perfect, Thank you so much @Dan Mason and @Leandro Ferreira . Saved me hours of debugging! I am sorry. can't seem to find the correct button to mark it as solved nvm, foun it!

Did you find this page helpful?