Answers for "laravel validation image file"

PHP
6

laravel image validation

'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
Posted by: Guest on May-30-2020
0

laravel upload image document validator

$document = $request->upload_file;
if ($document) {
  $validate = Validator::make(
    [
      'extension' => strtolower($request->upload_file->getClientOriginalExtension()),
    ],
    [
      'extension' => 'in:jpg,jpeg,png,gif,pdf,csv,docx,xlsx,txt',
    ]
  );
  if ($validate->fails())
    return redirect()->back()->withErrors($validator->errors());

  $fileName = $document->getClientOriginalName();
  $document->move('public/documents', $fileName);
  $data['upload_file'] = $fileName;
}
Posted by: Guest on June-24-2021

Code answers related to "laravel validation image file"

Browse Popular Code Answers by Language