问题描述
我想知道什么错误,因为我认为我的路径正确,但仍然给我错误 这是代码
public function importfile(Request $request){
$validator = Validator::make($request->all(),[
'file' => 'required||max:5000|mimes:xls,xls,csv'
]);
if($validator->passes()){
$dateTime = date('Ymd_His');
$file = $request->file('file');
$fileName = $dateTime . '-' . $file->getClientOriginalName();
$savePath = public_Path('/excelFile/');
$file->move($savePath,$fileName);
$getFileWithPath = public_Path("/excelFile/".$fileName);
$array = Excel::toCollection(new BreakByMin,$getFileWithPath);
return redirect()->back()
->with(['success'=>'File uploaded successfully.']);
}else{
return redirect()->back()
->with(['errors' => $validator->errors()->all()]);
}
}
当我尝试检查文件的确切位置时,却总是出现类似该目录的错误mk
https://code.visualstudio.com/docs/editor/variables-reference#_environment-variables
我不理解此错误,因为我检查清楚并且数据在那里
解决方法
您可以尝试使用此Storage::makeDirectory($yourDirectoryName)
来创建目录吗。