[eluser]generalsalt[/eluser]
I have two fields. One is 'userfile' the other is 'project_photos'. I am trying to upload the files uploaded from 'project_photos' to the projects folder and the 'userfile' to the 'thumbails' folder.
I have gone over this code again and again, it seems like it should work. It doesn't of course.
Code:
function do_upload()
{
$this->load->library('upload');
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '0';
$config['max_width'] = '0';
$config['max_height'] = '0';
foreach($_FILES as $key=>$value){
if($key == 'project_photos')
{
$config['upload_path'] = './pics/projects';
}
else{
$config['upload_path'] = './pics/thumbnails';
}
$this->upload->initialize($config);
}
if ( ! $this->upload->do_upload())
{
$errors['errors'] = $this->upload->display_errors();
$this->load->view('backend/upload_form', $errors);
}
else
{
$this->load->view('backend/upload_success');
}
}
Also, curious about the 'do_upload' function. What calls this function? Is it automatically called when A POST is detected?