0

I am developing a laravel web app. I created a section for managing employees. in this area I uploading a profile picture for employee.

when Uploading image there is no error and its working fine in add new employee area.

But when editing an employee the image upload area is not taking changed image ( new image)

here is my code..

   $photopaath = Employee::find(Input::get('employeeId'));
    $fullpath = $photopaath->emp_photo;

    if (Input::hasFile('picuplodr'))
        {
            File::delete(app_path().$fullpath);
            //$name = Input::file('picuplodr')->getClientOriginalName();
            $fileName = "photo".snake_case(Input::get('efname')).snake_case(Input::get('elname')).snake_case(Input::get('eemailaddrs'));
            Input::file('picuplodr')->move($destinationPath, $fileName);
            $path = Input::file('picuplodr')->getRealPath();
            $phototodb = '/uploads/'.$fileName;
            return "ssssssssssss";
        }
        else{
            $phototodb = $fullpath;
            return "ffffffff";
        }

its taking as else contition and returning as ffffffff.

Why this happening like this ?

I changed the image and not going to the if (Input::hasFile('picuplodr')) contition..

I changed the permission to 777 of my project directory also but not getting solution for this.

How can i solve this...?

1 Answer 1

1

Please check your form opening laravel blade tag having the 'files' => true attribute.

I think that is because you can get this error.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.