Level 18
$request->validate([
'companiesLogos' => 'required|file|size:512|mimes:png,jpg',
]);
change your validation and check.
Hello ,
I upload an image using FormData()(Javascript side) when I try to make a validation it's not working !
$request->validate([
'companiesLogos' => 'required|image|size:512',
]);
The validation error returns "The companies logos must be an image." even when I upload an image !
When I dd(request()->file('companiesLogos') the result is :
Illuminate\Http\UploadedFile {#1548
-test: false
-originalName: "5C51E427-1715-44E6-9B14D9487D7B7F2D_source.jpg"
-mimeType: "image/jpeg"
-error: 0
#hashName: null
path: "/tmp"
filename: "phpEwa4h8"
basename: "phpEwa4h8"
pathname: "/tmp/phpEwa4h8"
extension: ""
realPath: "/tmp/phpEwa4h8"
aTime: 2021-02-25 14:59:14
mTime: 2021-02-25 14:59:14
cTime: 2021-02-25 14:59:14
inode: 917514
size: 388750
perms: 0100600
owner: 1000
group: 1000
type: "file"
writable: true
readable: true
executable: false
file: true
dir: false
link: false
}
Any suggestion?
$request->validate([
'companiesLogos' => 'required|file|size:512|mimes:png,jpg',
]);
change your validation and check.
Please or to participate in this conversation.