laravel 5.2에서는 아래 코드를 사용하여 파일을 업로드 할 수 있지만 업로드 된 파일 이름을 데이터베이스에 저장하는 방법을 찾을 수 없습니다.
$destinationPath = "test/";
$file = $request->file('profile_pic');
if($file->isValid()){
$file->move($destinationPath, $file->getClientOriginalName());
$user = User::findOrFail(Auth::user()->id);
$input = $request->all();
$input['profile_pic']->pathname = $destinationPath.$file->getClientOriginalName();
$user->update($request->all());
}
누구든지 db에 파일 이름을 저장하는 방법을 알고 있습니까?
알았어. 어리석은 실수 !!
줄을 교체해야
$input['profile_pic']->pathname = $destinationPath.$file->getClientOriginalName();
...에
$input['profile_pic'] = $destinationPath.$file->getClientOriginalName();
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다