Hi Guys and Gals,
Im busy developing a small website for a client but i've hit a little snag, currently when i create a new "property" entry i can upload one picture with it that kind of defeats the purpose because i need to showcase the "property". how would I go about creating a album for a new property and then upload all the images with one upload field. Then how would I retrieve all the pictures in my view?
My current function for the upload looks like this:
function new_contractor(){
$this->check_is_validated();
$data = array('error' => '');
$config = array(
'upload_path' => './data/images/contractors/',
'allowed_types' => 'png|jpg|jpeg',
'max_size' => '204800',
'encrypt_name' => true
);
$this->load->library('upload',$config);
if(!$this->upload->do_upload()) {
$data['error'] = $this->upload->display_errors();
$data['title'] = 'Create a new Contractor';
$data['content'] = 'create_new_contractor';
$this->load->view('templates/dashboard/template', $data);
} else {
$upload_data = $this->upload->data();
$data=array(
'contractor_name' => $this->security->xss_clean($_POST['contractor_name']),
'contractor_email' => $this->security->xss_clean($_POST['contractor_email']),
'contractor_logo' => $upload_data['file_name'],
'contractor_description' => $this->security->xss_clean($_POST['post']),
'contractor_number' => $this->security->xss_clean($_POST['contractor_number']),
'contractor_address' => $this->security->xss_clean($_POST['contractor_address']),
'contractor_website' => $this->security->xss_clean($_POST['contractor_website']),
'active_contractor' => 1
);
$this->Contractor_m->insert_contractor($data);
redirect(base_url().'admin/contractors');
}
}
please could someone show me a small demo?