0

When I save, the controller does not receive the file of the form but the other file format still receives.

Here's my view code:

<form id="myForm" class="form-horizontal" action="" method="post" enctype="multipart/form-data">
    <div class="form-group">
        <label for="name" class="label-control col-md-3">Customer Name</label>
        <div class="col-md-8">
            <input type="text" name="txtCustomerName" class="form-control">
        </div>
    </div>
    <div class="form-group">
        <label for="mail" class="label-control col-md-3">Customer Mail</label>
        <div class="col-md-8">
            <input type="text" name="txtCustomerMail" class="form-control">
        </div>
    </div>
    <div class="form-group">
        <label for="phone" class="label-control col-md-3">Customer Phone</label>
        <div class="col-md-8">
            <input type="text" name="txtCustomerPhone" class="form-control">
        </div>
    </div>
    <div class="form-group">
        <label for="image" class="label-control col-md-3">Customer Image</label>
        <div class="col-md-8">
            <input type="file" name="fileCustomerImage" class="form-control">
        </div>
    </div>
</form>
theduck
  • 2,589
  • 13
  • 17
  • 23
Hoai
  • 1
  • Have a look at this thread. https://stackoverflow.com/questions/2320069/jquery-ajax-file-upload – Nishan Hitang Nov 20 '19 at 04:27
  • Are you using AJAX to submit the form? – R.S Namdhari Nov 20 '19 at 06:50
  • `public function addCustomer() { $customer_name = $this->input->post('txtCustomerName'); $customer_mail = $this->input->post('txtCustomerMail'); $customer_phone = $this->input->post('txtCustomerPhone'); $customer_image = $this->upload_image('fileCustomerImage'); $add = $this->ion_auth->addCustomer($customer_name, $customer_mail, $customer_phone, $customer_image); $msg['success'] = false; if($add){ $msg['success'] = true; } echo json_encode($msg); }` – Hoai Nov 20 '19 at 09:58

0 Answers0