How to upload multiple selected files in different attribute such as pic_1,pic_2,pic_3 in MYSQL
Views
<input type="file" name="carEvidence" multiple>
Controller
$this->validate($request, [
'carEvidence' => 'required|mimes:jpeg,png,jpg,zip,pdf|max:2048',
]);
$post = new Cars;
if ($files = $request->file('carEvidence')) {
$destinationPath = 'public/image/'; // upload path
$profileImage = date('YmdHis') . "." . $files->getClientOriginalExtension();
$files->move($destinationPath, $profileImage);
$post['carEvidence'] = "$profileImage";
}
$post->save();
return redirect('/internalaudit')->with('success', "Has been sent for Validation");
from Upload Multiple File In Different Attribute
No comments:
Post a Comment