How can I validate the filename of uploaded image file?
The scenario is:
When a user upload an image the filename must its id, if not then it will throw an message that the filename must the user id.
This is my code:
$validation = Validator::make($request->all(), [
'documenttosubmit' => 'required|array',
'datesubmitted' => 'required|array',
'file' => 'array',
'file.*' => 'mimetypes:' . implode(",", $allowedMimes) . '|max:' . (AppDocSubmitted::MAX_FILE_SIZE * 1024),
], [
'file.*.mimetypes' => 'File must be an image (jpg/jpeg/png) or a document (pdf).',
'file.*.max' => 'File size must be less than the maximum size of ' . AppDocSubmitted::MAX_FILE_SIZE . 'MB',
]);
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire