Validate Max File Size in Laravel

 


 

First, let’s see how to validate file size in Laravel. In your Form Request files or validate() method you can pass array with this parameter:

[
  'image' => 'required|mimes:jpeg,bmp,png|size:20000',
]

The last part means that size should be not more than 20 MB (20000 kB). But that may be not enough, cause file restrictions exist not only on Laravel application level.

Comments

Popular posts from this blog

Target class controller does not exist - Laravel 8