Laravel 更改上载图像的目录
如何更改上载图像的目录。 我想上传到App/public/files文件夹中 我的代码在这里:Laravel 更改上载图像的目录,laravel,file-upload,location,storage,Laravel,File Upload,Location,Storage,如何更改上载图像的目录。 我想上传到App/public/files文件夹中 我的代码在这里: public function update(Request $request, Organigramme $organigramme) { $id = $organigramme->id; $organigramme = Organigramme::find($id); $organigramme->matricule = $request->
public function update(Request $request, Organigramme $organigramme)
{
$id = $organigramme->id;
$organigramme = Organigramme::find($id);
$organigramme->matricule = $request->input('matricule');
if ($request->has('profile_image'))
{
$image = $request->file('profile_image');
$name = str_slug($request->input('matricule'));
$folder = '/uploads/images/';
$filePath = $folder . $name. '.' . $image->getClientOriginalExtension();
$this->uploadOne($image, $folder, 'public', $name);
$organigramme->profile_image = $filePath;
$organigramme->save();
}
return view( 'admin.organigrammes.show', compact('organigramme'));
}
在config/filesystems文件中添加新的保存路径。例如:
'images' => [
'driver' => 'local',
'root' => base_path().'/app/public/files',
],
在代码本身中,使用以下代码保存:
存储::磁盘('images')->put($path,$image)
$folder='/uploads/images/代码>更改这个?谢谢Kamlesh Paul谢谢。你救了我一天
'images' => [
'driver' => 'local',
'root' => base_path().'/app/public/files',
],