validate([ 'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048', ]); $imageName = time().'.'.$request->image->extension(); $request->image->storeAs('images', $imageName); return back() ->with('success','You have successfully upload image.') ->with('image',$imageName); } public function displayImage($fileName) { $path = 'images/'.$fileName; $file = Storage::get($path); $type = Storage::mimeType($path); $response = Response::make($file, 200); $response->header("Content-Type", $type); return $response; } }