imageupload

This commit is contained in:
Sampanna Rimal
2024-07-16 17:52:18 +05:45
parent de0b041520
commit 7d973eeed5
3 changed files with 44 additions and 11 deletions

View File

@ -64,6 +64,19 @@ class Accountheads extends CI_Controller
case 'edit':
$id = $this->uri->segment(4);
if (isset($_POST['submit'])) {
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = 128 * 1024;
$this->load->library('upload', $config);
if ($this->upload->do_upload('account_image')) {
$account_image_data = $this->upload->data();
$account_image = $account_image_data['file_name'];
}else{
$current_account_image = $this->db->query("SELECT account_image FROM tbl_accounts WHERE account_id = '$id'")->row()->account_image;
$account_image = $current_account_image;
}
// print_r($account_image);die;
$TableData = array(
'accategory_id' => filter_var($_POST['accategory_id']),
//'account_code' => filter_var($_POST['account_code']),
@ -78,6 +91,7 @@ class Accountheads extends CI_Controller
'account_partyemail' => filter_var($_POST['account_partyemail']),
'account_partycontactperson' => filter_var($_POST['account_partycontactperson']),
'account_partycontactpersoncontact' => filter_var($_POST['account_partycontactpersoncontact']),
'account_image' => $account_image,
'created_on' => date('Y-m-d H:i:s'),
'created_by' => 'admin',
'remarks' => filter_var($_POST['remarks']),