if($this->form_validation->run())
{
$prop_title = ucwords(strtolower($this->security->xss_clean($this->input->post('prop_title'))));
$prop_status = ucwords(strtolower($this->security->xss_clean($this->input->post('prop_status'))));
$prop_type = ucwords(strtolower($this->security->xss_clean($this->input->post('prop_type'))));
$prop_price = $this->security->xss_clean($this->input->post('prop_price'));
$prop_sqft = $this->security->xss_clean($this->input->post('prop_sqft'));
$prop_rooms = $this->security->xss_clean($this->input->post('prop_rooms'));
$prop_address = $this->security->xss_clean($this->input->post('prop_address'));
$prop_owner_name = $this->security->xss_clean($this->input->post('prop_owner_name'));
$prop_owner_email = $this->security->xss_clean($this->input->post('prop_owner_email'));
$prop_owner_phone = $this->security->xss_clean($this->input->post('prop_owner_phone'));
$prop_detailed_info = $this->security->xss_clean($this->input->post('prop_detailed_info'));
$prop_current_status = $this->security->xss_clean($this->input->post('prop_current_status'));
$propertyInfo = array('title'=>$prop_title, 'status'=>$prop_status, 'type'=>$prop_type, 'price'=>$prop_price,
'sqft'=>$prop_sqft, 'rooms'=>$prop_rooms, 'address'=>$prop_address, 'name'=>$prop_owner_name,
'email'=>$prop_owner_email, 'phone'=>$prop_owner_phone, 'detailedInfo'=>$prop_detailed_info,
'currentStatus'=>$prop_current_status);
$result = $this->property_model->addNewProperty($propertyInfo);
echo $result.'<br>';
if (!empty($_FILES)) {
$count_img = count($_FILES['file']['name']);
foreach($_FILES['file']['tmp_name'] as $key => $value) {
$tempFile = $_FILES['file']['tmp_name'][$key];
$fileName = $_FILES['file']['name'][$key];
$targetPath = 'property-images/';
$targetFile = $targetPath . $fileName ;
//$this->load->model('user_model');
$imgData = array('path'=>$targetFile,'propertyid'=>$result);
if(move_uploaded_file($tempFile, $targetFile))
{
echo 'Move upload file and add propertyImgs<br>';
$this->property_model->addPropertyImgs($imgData);
}
}
} else {
echo '$_FILES is empty';
}
die();
}