application/modules/template/payroll.php
// function upload data xls to mysql using ajax and validation
function upload data xls to mysql using ajax and validation
function upload data xls to mysql using ajax and validation
public function import_adhoc()
	{
		if (!empty($_FILES['file_import']['name'])) {
		$upload = $this->_do_upload_adhoc();
		}
		if(empty($_FILES['file_import']['name'])) 
        {
            $data['inputerror'][] = 'file_import';
			$data['error_string'][] = 'No File Selected'; 
			$data['status'] = FALSE;
			echo json_encode($data);
			exit();
		}		
		echo json_encode(array("status" => TRUE));
	}
public function import_adhoc ( ) { if ( ! empty ( $ _FILES [ 'file_import' ] [ 'name' ] ) ) { $ upload = $ this -> _do_upload_adhoc ( ) ; } if ( empty ( $ _FILES [ 'file_import' ] [ 'name' ] ) ) { $ data [ 'inputerror' ] [ ] = 'file_import' ; $ data [ 'error_string' ] [ ] = 'No File Selected' ; $ data [ 'status' ] = FALSE ; echo json_encode ( $ data ) ; exit ( ) ; } echo json_encode ( array ( " status " => TRUE ) ) ; }
function upload data xls to mysql using ajax and validation
function upload data xls to mysql using ajax and validation
# code... //$data['file_import_excel_to_db'] = $upload; //upload and validate //show ajax error //$insert = $this->emp_attribute->save($data);