#File upload for large files

33 messages · Page 1 of 1 (latest)

lunar kestrel
#

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?

echo fractal
#

there is also livewire max size 😃

coarse stirrup
#

You have to update your livewire config file.

echo fractal
#

just publish its config and edit it

lunar kestrel
#

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...
],
echo fractal
#

refresh you config and caches

lunar kestrel
#

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

echo fractal
#

well, there is only limitationa on Livewire, PHP, Server (ngnix/appache). I don't know other possible issues. is this on local or production

lunar kestrel
#

local works fine. this is on production

echo fractal
#

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

lunar kestrel
#

I'm using digital ocean ubuntu server

echo fractal
#

what about the software server, is it ngnix or appache

lunar kestrel
#

nginx

echo fractal
#

try this in the terminal:
nginx -T | grep client_max_body_size

#

not expert so it maybe another name

lunar kestrel
#

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;

echo fractal
#

So is it fixed now?

lunar kestrel
#

the error no longer pops up in the log but its livewire upload that still throws error

echo fractal
#

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

lunar kestrel
#

okay sure let me do that now

echo fractal
#

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

lunar kestrel
lunar kestrel
lunar kestrel
#

guess what the issue was all along? 😭 @echo fractal
was modifying the wrong php ini file

shut valley
#

did you check APP_URL?

lunar kestrel
#

modified it before i even began testing. issue had to do with the wrong php ini file. sigh!

hexed grotto
#

I have this issue too. I'll try your fix and see if it works.

lunar kestrel
#

sure. let me know if you encounter any issues @hexed grotto

hexed grotto
#

Okay so what line of the ini file did you modify and what did you set it to? I see you're from 🇬🇭 @lunar kestrel