diff --git a/application/controllers/emergencypurchaseorder.php b/application/controllers/emergencypurchaseorder.php index 93a50c9f..3ce50da8 100644 --- a/application/controllers/emergencypurchaseorder.php +++ b/application/controllers/emergencypurchaseorder.php @@ -529,12 +529,14 @@ $prefile =array(); if($index == 1){ $filename = $value; } - } - + } + + if(!empty($filename)) + { $myfile = array('FilePath'=>$filename,'PONO'=>$PONO); $this->purchaseorder_model->fileupload($myfile); - + } } diff --git a/application/controllers/purchaseorder.php b/application/controllers/purchaseorder.php index 22c4b9e8..d17a4605 100644 --- a/application/controllers/purchaseorder.php +++ b/application/controllers/purchaseorder.php @@ -4190,9 +4190,12 @@ $fcount = 0; if($fcount == 0) { - $Picture = $this->adfile(); - $filelist =array('PONO'=>$pono,'IGRNO'=>$igr,'FilePath'=>$Picture); - $uploadfiles = $this->purchaseorder_model->insertfile($filelist); + + if(!empty($new_file_name)) + { $Picture = $this->adfile(); + $filelist =array('PONO'=>$pono,'IGRNO'=>$igr,'FilePath'=>$Picture); + $uploadfiles = $this->purchaseorder_model->insertfile($filelist); + } } if($uploadfiles > 0){ @@ -4200,7 +4203,7 @@ $fcount = 0; } else { - echo "File name already Exist"; + echo " File name already Exist"; } } diff --git a/application/controllers/servicepurchaseorder.php b/application/controllers/servicepurchaseorder.php index b7c18806..53af4688 100644 --- a/application/controllers/servicepurchaseorder.php +++ b/application/controllers/servicepurchaseorder.php @@ -662,7 +662,6 @@ function uploadfile() $pono= $this->input->post('PONO'); - $new_file_name =$_FILES['file']['name']; @@ -688,16 +687,22 @@ $upfile=''; if($fcount == 0) { - $Picture = $this->adfile(); - - $filelist =array('PONO'=>$pono,'FilePath'=>$Picture); - $upfile = $this->purchaseorder_model->insertfile($filelist); + + if(!empty($new_file_name)) + { + $Picture = $this->adfile(); + $filelist =array('PONO'=>$pono,'FilePath'=>$Picture); + $upfile = $this->purchaseorder_model->insertfile($filelist); + } + } + if($upfile > 0){ echo "file updated successfully!"; } else{ echo "File name already Exist"; + } } diff --git a/application/views/EditservicePurchaseorder.php b/application/views/EditservicePurchaseorder.php index f574d683..469f3d73 100755 --- a/application/views/EditservicePurchaseorder.php +++ b/application/views/EditservicePurchaseorder.php @@ -3894,8 +3894,11 @@ function addRow() //alert(); var file = $('#images').val(); + //alert(file); +// return false; - if (file=='') + if (file == '' || file == undefined) + { alert('File not found'); diff --git a/application/views/editRevenuepurchaseorder.php b/application/views/editRevenuepurchaseorder.php index 86e1cc56..68242237 100644 --- a/application/views/editRevenuepurchaseorder.php +++ b/application/views/editRevenuepurchaseorder.php @@ -5827,7 +5827,7 @@ else{ //var file = $('#imag').val(); var file = $('#images').val(); - if (file=='') + if (file == '' || file == undefined) { alert('File not found'); diff --git a/system/libraries/Upload.php b/system/libraries/Upload.php index 4b4eca5d..d8337ec7 100755 --- a/system/libraries/Upload.php +++ b/system/libraries/Upload.php @@ -102,7 +102,7 @@ class CI_Upload { 'image_size_str' => '', 'error_msg' => array(), 'mimes' => array(), - 'remove_spaces' => TRUE, + 'remove_spaces' => FALSE, 'xss_clean' => FALSE, 'temp_prefix' => "temp_file_", 'client_name' => ''