Input file with max size validation in laravel

Updated at 16-Aug-2021, By samar

Input file with max size validation in laravel

With this article, we will examine several different instances of how to solve the "Input file with max size validation in laravel".

You can validate input file size using the max validation rule. Which validates the file if the value of file size will be greater than the specified value.
  • Laravel file size validation

    //Import validator facades
    use Illuminate\Support\Facades\Validator;
    
    //Call validator facades on the request input file
    $validator = Validator::make($request->all(), [
        'file' => 'max:500000',
    ]);
    

    You can validate file size in laravel using the max attribute on the validator facades. 

Back to code snippet queries related laravel