file upload issue in book

This commit is contained in:
heama 2024-01-20 13:51:27 +05:30
parent a73f062a28
commit 94ebbb5793

View File

@ -145,9 +145,16 @@ class Books extends BaseController
##Step 5 : Check Existing and New Image Name Same Or not same no use to move on target folder
if($new_img_name !== $existing_img_name){
$existing_images_record = $BooksModel->db->table('book_images')
->where(['book_id'=>$book_id,'isactive'=>1,'type'=>1])
->get()->getRow();
->where(['book_id'=>$book_id,'isactive'=>1,'type'=>1])
->get()->getRow();
if ($existing_images_record) {
$existing_image_id = $existing_images_record->book_img_id;
} else {
// Handle the case when the record does not exist
$existing_image_id = null; // Or set it to an appropriate default value
}
$this->logger->info("Books: Image Name are Differ".$new_img_name." & ".$existing_img_name);
## Step 6 : Different Image Name means removed on target folder using Unlink;
if ($existing_image_id && $existing_img_name && is_file($img_path.$existing_img_name)) {