更新时间:2022-01-01 06:28:07
使用clientExtension()
而不是getClientOriginalExtension()
并确保您的路径正确,在这里我定义了public路径.
use clientExtension()
instead of getClientOriginalExtension()
and make sure your path is correct here I defined the path of public.
if ($request->hasFile('image')) {
$file = $request->image;
$destinationPath = public_path().'/images/';
$filename= $student->username . '.'.$file->clientExtension();
$file->move($destinationPath, $filename);
$student->image=$filename;
}