Closed OlyaK95 closed 10 months ago
Check the mime of the file locally. Here is how you do it on linux
file --mime-type -b more.pdf
if it does not say applicaiton/pdf, then filepond is doing it correctly.
file --mime-type -b more.pdf
Maybe you can provide a link to the file that does not work? I have tried with several pdf files but cannot get it to fail
What is the error message exactly? I cannot read it ;)
Maybe you can provide a link to the file that does not work? I have tried with several pdf files but cannot get it to fail
Yes, of course https://disk.yandex.ru/d/xl9FHJ-ClLjt2A
What is the error message exactly? I cannot read it ;)
1) Error during load. Tap to retry
2) File of invalid type. Waiting or application/pdf
Console error: Failed to load resource: the server responded with a status of 422 (Unprocessable Content)
Probably missing validation rule from the config/livewire.php temporary file uploads section?
Probably missing validation rule from the config/livewire.php temporary file uploads section?
I have no config/livewire.php file. Do I need it?
Thinking about it again, probably not
But a 422 error doesn't sound like it's coming from Filament, it sounds like something on your server is blocking PDF uploads
Thinking about it again, probably not
But a 422 error doesn't sound like it's coming from Filament, it sounds like something on your server is blocking PDF uploads
@danharrin You was right. I don't know, but by default Livewire have validation that uploaded files can be max 12 MB. https://livewire.laravel.com/docs/uploads#global-validation
I added config/livewire.php with text:
<?php
return [
"temporary_file_upload" => [
"rules" => "file|mimes:pdf,zip|max:49152",
],
];
And the problem with PDF gone.
About ZIP files I have another solution - I added more file types:
FileUpload::make("documentation")
->label("ZIP")
->disk("public")
->directory("documentations")
->visibility("public")
->acceptedFileTypes([
"application/x-compressed",
"application/x-zip-compressed",
"application/zip",
"multipart/x-zip",
])
->maxSize(49152)
->maxFiles(1)
->downloadable()
->disabled(
fn() => !auth()
->user()
->isAdminstrator()
)
Package
filament/filament
Package Version
3.0.97
Laravel Version
10.32.1
Livewire Version
3.1.0
PHP Version
8.2.8
Problem description
An error occurs when trying to upload some files. At the beginning I thought. that's a matter of file size, but it doesn't matter. Some files are uploaded, some are not.
Resource file:
php.ini
Some screenshots
Expected behavior
FileUpload must upload any PDF or ZIP files.
Steps to reproduce
Copy my code to any Resource file.
Reproduction repository
https://github.com/filamentphp/demo
Relevant log output
No response