File upload for large files

I have tried all possible ways to upload large files using filament. This works on my local machine but once i deployed to server, large files are not able to upload. This is how my form schema looks like: FileUpload::make('file') ->label('Upload Merchant pay file here') ->rules(['required', 'file', 'max:122880']) ->maxSize(122880) ->acceptedFileTypes(['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/xlsx']) ->helperText('Only .xlsx files are allowed') ->required(), made these changes in my php.ini file: post_max_size = 120M, upload_max_filesize = 120M added this to my nginx config file: client_max_body_size = 200M funny thing is that it was not working on my local before and then added this line: ->rules(['required', 'file', 'max:122880']) which got it to work for large files. I figured it should work once i deploy on my server but issue remained the same. i'm still not able to successfully upload. what else do i do? nothing shows in my laravel log, nginx log and php-fpm log. any suggestions?
No description
27 Replies
Mohamed Ayaou
Mohamed Ayaou3w ago
there is also livewire max size 😃
Julien B. (aka yebor974)
You have to update your livewire config file.
Mohamed Ayaou
Mohamed Ayaou3w ago
just publish its config and edit it
owulanii
owulaniiOP3w ago
lol forgot to mention I already explored that option as well. But it still doesn't work 'temporary_file_upload' => [ 'disk' => null, // Example: 'local', 's3' | Default: 'default' 'rules' => ['required', 'file', 'max:122880'], // 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', 'vnd.openxmlformats-officedocument.spreadsheetml.sheet', ], 'upload_max_file_size' => 122880, // 120 MB 'chunk_size' => 8192, // 8 MB per chunk 'max_file_uploads' => 10, // Allow multiple uploads if needed 'max_upload_time' => 5, // Max duration (in minutes) before an upload is invalidated... 'cleanup' => true, // Should cleanup temporary uploads older than 24 hrs... ],
Mohamed Ayaou
Mohamed Ayaou3w ago
refresh you config and caches
owulanii
owulaniiOP3w ago
php artisan cache:clear
php artisan config:clear
php artisan config:cache
php artisan route:clear
php artisan route:cache
php artisan view:clear
php artisan optimize:clear
php artisan optimize
done these but still error
Mohamed Ayaou
Mohamed Ayaou3w ago
well, there is only limitationa on Livewire, PHP, Server (ngnix/appache). I don't know other possible issues. is this on local or production
owulanii
owulaniiOP3w ago
local works fine. this is on production
Mohamed Ayaou
Mohamed Ayaou3w ago
Ah, so I think the serever config override is not accepted by the hosting provider, can you test it somehow? they may force other limitations to lower their costs
owulanii
owulaniiOP3w ago
I'm using digital ocean ubuntu server
Mohamed Ayaou
Mohamed Ayaou3w ago
what about the software server, is it ngnix or appache
owulanii
owulaniiOP3w ago
nginx
Mohamed Ayaou
Mohamed Ayaou3w ago
try this in the terminal: nginx -T | grep client_max_body_size not expert so it maybe another name
owulanii
owulaniiOP3w ago
yeahh first had that issue then placed it in my nginx http block which took away that error client_max_body_size 128M; #client_max_body_size 120M; #client_max_body_size 120M; #client_max_body_size 120M;
Mohamed Ayaou
Mohamed Ayaou3w ago
So is it fixed now?
owulanii
owulaniiOP3w ago
the error no longer pops up in the log but its livewire upload that still throws error
Mohamed Ayaou
Mohamed Ayaou3w ago
try to log the config to the frontend: public $uploadLimit; public function mount() { $this->uploadLimit = config('livewire.file_upload.max_size') / 1024; // Convert to MB } then: <p>Maximum upload size: {{ $uploadLimit }} MB</p> or a js log to check the config used value
owulanii
owulaniiOP3w ago
okay sure let me do that now
Mohamed Ayaou
Mohamed Ayaou3w ago
mmm, I think it is something with the server config as it is working in the local. no idea, sorry. maybe search about similar issues with DO servers from the same service you use
owulanii
owulaniiOP3w ago
i get 0MB both on local and production yeahh i should probably try it on a different host. i'd research about that. thanks a lot for the suggestion 😃 guess what the issue was all along? 😭 @Mohamed Ayaou was modifying the wrong php ini file
Azad Furkan ŞAKAR
did you check APP_URL?
owulanii
owulaniiOP3w ago
modified it before i even began testing. issue had to do with the wrong php ini file. sigh!
eskay_amadeus
eskay_amadeus3w ago
I have this issue too. I'll try your fix and see if it works.
owulanii
owulaniiOP3w ago
sure. let me know if you encounter any issues @eskay_amadeus
eskay_amadeus
eskay_amadeus3w ago
Okay so what line of the ini file did you modify and what did you set it to? I see you're from 🇬🇭 @owulanii
Dennis Koch
Dennis Koch2w ago
Check the first message:
made these changes in my php.ini file:
post_max_size = 120M,
upload_max_filesize = 120M
post_max_size = 120M,
upload_max_filesize = 120M
Want results from more Discord servers?
Add your server