You need to set $directory = "C:your_projectpublicuploads";
And Setting your uploads
folder have write permission
Or you can try this way. Edit your disk at: config/filesystems.php
'disks' => [
'uploads' => [
'driver' => 'local',
'root' => public_path() . '/uploads',
],
'custom' => [
'driver' => 'custom',
'root' => 'c:/bck',
]
]
And handle at your Controller
public function uploadFile(Request $request) {
$data = $request->all();
$fileUpload = $data['file'];
$originalFileName = $fileName->getClientOriginalName();
Storage::disk('uploads')->put($originalFileName, file_get_contents($fileUpload));
}
public function customUploadFile(Request $request) {
$data = $request->all();
$fileUpload = $data['file'];
$originalFileName = $fileName->getClientOriginalName();
Storage::disk('custom')->put($originalFileName, file_get_contents($fileUpload));
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…