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 file name and the file, which then uses my upload.php controller to upload the file to the server. Currently this part is working, I just need to insert the file name (entered from the form) into the table.
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 file name (entered in the form) plus the actual filename and extension into the database? The code above also encrypts the filename.
Thank you.