Ruka Xing
Ruka Xing

Reputation: 642

Laravel file upload error Content-Length

Error

Warning: POST Content-Length of 31492035 bytes exceeds the limit of 8388608 bytes in Unknown on line 0

App.php

'allowedFileTypes' => 'jpg,jpeg,bmp,png,pdf,mp4',
'maxFileSize' => 10000000000*2,

Controller Create

$rules = ['attachments.*' => 'required|mimes:'.$allowedFileTypes.'|max:'.$maxFileSize];
Storage::put($destinationPath.$fileName.'.'.$file->getClientOriginalExtension(),file_get_contents($file->getRealPath()));

Upvotes: 1

Views: 1420

Answers (1)

Babak Asadzadeh
Babak Asadzadeh

Reputation: 1239

8388608 bytes is 8M, the default limit in PHP. Update your post_max_size in php.ini to a larger value.

upload_max_filesize sets the max file size that a user can upload while post_max_size sets the maximum amount of data that can be sent via a POST in a form.

So you can make upload_max_filesize larger.

Upvotes: 3

Related Questions