简体   繁体   中英

Laravel image file Upload Error

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...?

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

I think that is because you can get this error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM