Copy code
$validator = Validator::make($request->all(), [
'file' => 'required|max:2048', // maximum 2 MB
]);
Copy code
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreFileRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
{
return [
'file' => 'required|max:2048', // maximum 2 MB
];
}
}
Copy code
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class StoreFileRequest extends FormRequest
{
public function authorize()
{
return true;
}
public function rules()
{
return [
'file' => 'required|max:2048', // maximum 2 MB
];
}
}
Posting Komentar untuk "Image validation on laravel 8"