Not sure if that is possible, I think the servers limitations complains before it even gets that far.
I would start with ckecking the file size client side. Use a custom error view for it.
How to catch the error Illuminate\ Http \ Exceptions\PostTooLargeException through validation ?
If the user tries to upload some other kind of file then its able to validate but if the size is too large then it does not give error message ?
Controller
if ($request->file('imageFile')) {
$request->validate([
'imageFile.*' => 'mimes:jpeg,jpg,png|max:10000'
]);
$images = $request->file('imageFile');
foreach ($images as $img) {
$make_name = hexdec(uniqid()).'.'.$img->getClientOriginalExtension();
Image::make($img)->save('upload/multipleimages/'.$make_name);
Listingmultipleimage::insert([
'image' => $make_name,
'listingid' => $listid,
'created_at' => Carbon::now()
]);
}
}
@FounderStartup This is one way to do it
https://techsolutionstuff.com/post/how-to-validate-max-file-size-using-javascript
Please or to participate in this conversation.