Hi there,
I’m creating a file upload in CodeIgniter, that uploads the file to the server and then stores some data in the database.
I have a form that asks for a (friendly) file name and the file, which then uses my upload.php controller to upload the file to the server. Currently the actual upload of the file to the server is working, I just need to insert the (friendly) file name and the following from $data; file_name, file_type, file_ext and file_size.
Here is my upload frunction in the upload controller;
function do_upload()
{
$config['upload_path'] = './gfiles/';
$config['allowed_types'] = 'gif|jpg|jpeg|bmp|png|psd|pdf|eps|ai|zip|indd|qxt';
$config['encrypt_name'] = 'TRUE';
//$config['max_size'] = '100';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->db->insert('files', $_POST);
}
}
Wondered if anyone has any pointers on how to get the above data into the database?
Thank you.
