如何获取路径laravel错误MK这样的目录或文件?

问题描述

我想知道什么错误,因为我认为我的路径正确,但仍然给我错误 这是代码

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

这是错误

enter image description here

我不理解此错误,因为我检查清楚并且数据在那里

解决方法

您可以尝试使用此Storage::makeDirectory($yourDirectoryName)来创建目录吗。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...