diff --git a/app/Controllers/Employeedetails.php b/app/Controllers/Employeedetails.php index 1c020e38..5344a673 100755 --- a/app/Controllers/Employeedetails.php +++ b/app/Controllers/Employeedetails.php @@ -199,37 +199,7 @@ class Employeedetails extends BaseController * This function is used to save the new Employee form in the database */ /** - * This function is used to save the new Employee form in the database - */ - /** - * This function is used to save the new Employee form in the database - */ - /** - * This function is used to save the new Employee form in the database - */ - /** - * This function is used to save the new Employee form in the database - */ - /** - * This function is used to save the new Employee form in the database - */ - /** - * This function is used to save the new Employee form in the database - */ - /** - * This function is used to save the new Employee form in the database - */ - /** - * This function is used to save the new Employee form in the database - */ - /** - * This function is used to save the new Employee form in the database - */ - /** - * This function is used to save the new Employee form in the database - */ - /** - * This function is used to save the new Employee form in the database + */ @@ -249,6 +219,10 @@ class Employeedetails extends BaseController $photo->move($uploadDir, $newName); $Picture = $newName; } + else{ + echo "Incorrect file format provided"; + return false; + } } } // $Profile = $this->request->getPost('photo'); @@ -661,38 +635,7 @@ class Employeedetails extends BaseController } /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ - /* To Update the employee details*/ + function UpdateEmployee() @@ -700,41 +643,12 @@ class Employeedetails extends BaseController $EmpId = $this->request->getGet('empId'); - $PictureName = $this->request->getPost('Image'); - $ModifyPictureName = $this->request->getPost('ModifyImage'); + //if it is empty it means the default image is selected + $oldPictureName = $this->request->getPost('oldImageName'); $Picture = ""; - if ($PictureName != '') { - - - if (strlen((string)$ModifyPictureName) == 0) { - - $Picture = $PictureName; - } else { - - $photo = $this->request->getFile('ModifyImage'); - if (!$photo || !$photo->isValid()) { - $photo = $this->request->getFile('photo'); - } - if (isset($photo)) { - if ($photo->isValid() && !$photo->hasMoved()) { - $uploadDir = ROOTPATH . 'public/uploads/images/'; - $allowedTypes = ['jpg', 'jpeg', 'png', 'gif']; - if (in_array($photo->getExtension(), $allowedTypes)) { - $newName = $photo->getRandomName(); - if (!is_dir($uploadDir)) { - mkdir($uploadDir, 0777, true); - } - $photo->move($uploadDir, $newName); - $Picture = $newName; - } - } - } - } - } else { - //echo 'Not Exists'; - $photo = $this->request->getFile('photo'); - if (isset($photo)) { - if ($photo->isValid() && !$photo->hasMoved()) { + $photo = $this->request->getFile('photo'); + + if (isset($photo) && $photo->isValid() && !$photo->hasMoved()) { $uploadDir = ROOTPATH . 'public/uploads/images/'; $allowedTypes = ['jpg', 'jpeg', 'png', 'gif']; if (in_array($photo->getExtension(), $allowedTypes)) { @@ -745,10 +659,11 @@ class Employeedetails extends BaseController $photo->move($uploadDir, $newName); $Picture = $newName; } - } + + }else{ + $Picture=$oldPictureName; } - } - //echo $Picture; + $FirstName = $this->request->getPost('FirstName'); $LastName = $this->request->getPost('LastName'); diff --git a/app/Views/addEmployeenew.php b/app/Views/addEmployeenew.php index 690ced32..25f0e013 100755 --- a/app/Views/addEmployeenew.php +++ b/app/Views/addEmployeenew.php @@ -430,7 +430,7 @@