The following is my image upload function,
public function postUserupdate(Request $request)
{
if(!\Auth::check()) return Redirect::to('user/login');
$userid = Auth::user()->id;
if(!is_null(Input::file('avatar')))
{
$file = $request->file('avatar');
$destinationPath = './uploads/users/';
$filename = $file->getClientOriginalName();
$extension = $file->getClientOriginalExtension(); //if you need extension of the file
$newfilename = \Session::get('uid').'.'.$extension;
$uploadSuccess = $request->file('avatar')->move($destinationPath, $newfilename);
if( $uploadSuccess ) {
$data['avatar'] = $newfilename;
}
}
$user = \User::find(\Session::get('uid'));
$user->first_name = $request->input('first_name');
$user->last_name = $request->input('last_name');
// $user->email = $request->input('email');
if(isset( $data['avatar'])) $user->avatar = $newfilename;
$user->save();
}
And here I'm saving some data's like first_name,last_name,email
and also an image
if exists into database.
Here I'm having a problem while upload an image
./uploads/users/
./uploads/users/
4.jpg
/opt/lampp/temp/phpcVo8JH
./uploads/users/4.jpg
bool(true)
If I select an image and submit the form it upload that particular image into the desired folder but it always shows the above message after upload completed.
Why this happening could someone help me out of this..I don't know what's the actual issue is..
Thank you,
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire