我正在尝试在我的 CodeIgniter 函数中设置文件上传..
但无论我尝试做什么,我都会遇到错误......
谁能帮我解决我的问题?
我在控制器中的功能。
function insert_user_details(){
$this->load->library('form_validation');
$this->form_validation->set_rules('UserName', 'Username', 'callback_username_check');
//$this->form_validation->set_rules('Password', 'Password', 'required');
//$this->form_validation->set_rules('Email', 'Email', 'required|email');
//$this->form_validation->set_rules('FirstName','FirstName', 'required');
//$this->form_validation->set_rules('MiddleName','FirstName', 'required');
//$this->form_validation->set_rules('LastName','FirstName', 'required');
if ($this->form_validation->run() == FALSE)
{
echo 'Please Fill in the Forms Correctly' ;
}
else
{
$config['upload_path'] = '../user_uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
$pass = $this->input->post('Password');
$pass = md5($pass);
$data = array(
'UserName'=>$this->input->post('UserName'),
'Password'=>$pass,
'FirstName'=>$this->input->post('FirstName'),
'MiddleNames'=>$this->input->post('MiddleName'),
'LastName'=>$this->input->post('LastName'),
'DateOfBirth'=>date('Y-m-d',strtotime($_POST['DateOfBirth'])),
'AddressLine1'=>$this->input->post('AddressLine1'),
'AddressLine2'=>$this->input->post('AddressLine2'),
'City'=>$this->input->post('City'),
'CountryID'=>$this->input->post('CountryID'),
'NationalityCountryID'=>$this->input->post('NationalityCountryID'),
'MobileNo'=>$this->input->post('MobileNo'),
'WorkPhoneNo'=>$this->input->post('WorkPhoneNo'),
'WorkPhoneExtention'=>$this->input->post('WorkPhoneExtension'),
'NationalTaxNumber'=>$this->input->post('NationalTaxNumber'),
'NationalIDCardNo'=>$this->input->post('NationalIDCardNo'),
'MaritalStausID'=>$this->input->post('UI_LanguageID'),
'ReligionID'=>$this->input->post('ReligionID'),
'Photograph' => $this->upload->data(),
'Email'=>$this->input->post('Email'),
'WebUrl'=>$this->input->post('WebUrl'),
'HighestEducation'=>$this->input->post('HighestEducation'),
'UserResumeFile'=> 'res.jpg',
'UI_LanguageID'=> $this->input->post('UI_LanguageID'),
'LastLoginDate'=>'2013-02-24 00:00:00',
'LastLoginIP'=>'192.168.1.2',
'Remarks'=>$this->input->post('Remarks'),
'CreateByUserID'=>'1',
'CreateAt'=>'2013-02-24 00:00:00',
'ModifiedByUserID'=>'2',
'ModifiedAt'=>'2013-02-24 00:00:00',
'IsActive'=>'1'
);
$table = 'sys_user_accounts';
$this->common_model->insert_record($table, $data);
echo 'Success Message' ;
//$this->load->view('user_management/success','','true');
}
}
这是视图文件。
'照片', 'id' => '照片', 'placeholder' => '上传用户照片', 'maxlength' => '250' ); echo form_upload($input_field_attributes); ?>是的,我使用了多部分
echo form_open_multipart('user_management/manage_users',array('id' => 'insert_user'));
所以谁能告诉我为什么我在萤火虫中得到这个错误?以及如何解决?
> Error Number: 1054
Unknown column 'Array' in 'field list'
INSERT INTO `sys_user_accounts` (`UserName`, `Password`, `FirstName`, `MiddleNames`, `LastName`, `DateOfBirth`, `AddressLine1`, `AddressLine2`, `City`, `CountryID`, `NationalityCountryID`, `MobileNo`, `WorkPhoneNo`, `WorkPhoneExtention`, `NationalTaxNumber`, `NationalIDCardNo`, `MaritalStausID`, `ReligionID`, `Photograph`, `Email`, `WebUrl`, `HighestEducation`, `UserResumeFile`, `UI_LanguageID`, `LastLoginDate`, `LastLoginIP`, `Remarks`, `CreateByUserID`, `CreateAt`, `ModifiedByUserID`, `ModifiedAt`, `IsActive`) VALUES ('hello', '1a1dc91c907325c69271ddf0c944bc72', 'fda', 'fda', 'fad', '2010-03-03', '1', 0, '1', 0, 0, '1', '1', 0, '1', 0, 0, 0, Array, 0, 0, 0, 'res.jpg', 0, '2013-02-24 00:00:00', '192.168.1.2', 0, '1', '2013-02-24 00:00:00', '2', '2013-02-24 00:00:00', '1')
Filename: C:\xampp\htdocs\projects\zorkif_nextgen\system\database\DB_driver.php
Line Number: 330