0

I want to know what the error, because i think my path are correct but still giving me error as path here is the code

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()]);
    }   
}

when i tried to check where my file are the file are exactly in there but i always got an error mk such dir

enter image description here

here is the error enter image description here

i don't understand this error, because i check it clearly and the data is there

1 Answers1

0

Can you try this Storage::makeDirectory($yourDirectoryName) for the creation of directory.

Jayant
  • 280
  • 2
  • 6