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.

Answers 1
  • 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',
    ]);
    
    0

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

  • Back to code snippet queries related laravel