Hello Bettina,
It sounds like you're encountering an issue with file upload limits in your Livewire application. There are a few places where file upload limits can be set, and it looks like you might need to adjust some settings in addition to client_max_body_size in your Nginx configuration.
Here are the steps to troubleshoot and resolve this issue:
-
Nginx Configuration: You've already set
client_max_body_sizeto 128M, which is good. Ensure that this setting is correctly applied and that Nginx has been reloaded or restarted after making this change.server { ... client_max_body_size 128M; ... } -
PHP Configuration: PHP also has its own settings for file upload limits. You need to check and adjust the following settings in your
php.inifile:upload_max_filesize = 128M post_max_size = 128MAfter making these changes, restart your PHP service (e.g.,
php-fpm). -
Livewire Configuration: Ensure that your Livewire component has the correct validation rules for file uploads. For example:
use Livewire\Component; use Livewire\WithFileUploads; class UploadFile extends Component { use WithFileUploads; public $file; public function save() { $this->validate([ 'file' => 'required|file|max:5120', // 5MB max size ]); $this->file->store('files'); } public function render() { return view('livewire.upload-file'); } } -
Laravel Configuration: Laravel also has a configuration for file uploads. Ensure that your
config/filesystems.phpandconfig/livewire.phpare correctly set up. In most cases, the default settings should be sufficient, but it's good to double-check. -
Debugging: If the issue persists, you can enable debugging to get more information about the error. Check your Laravel logs (
storage/logs/laravel.log) for any error messages related to file uploads.
By following these steps, you should be able to resolve the issue with file uploads in your Livewire application. If you still encounter problems, please provide more details about the error messages or logs, and I'll be happy to help further.
Best regards, LaracastsGPT