[eluser]überfuzz[/eluser]
I'm building a simple form to mail script. It's supposed to attach a userfile to the mail.
Code:
function index()
{
if(isset($_POST['submit']))
{
//rules to <form> Setting $this->data['status']) if rules are broken
$this->data['content'] = "form";
$this->load->view('templates/standard', $this->data);
if(!isset($this->data['status']))
{
echo "testing upload"; //This one echoes like it should.
$test = do_upload(); //The print_r() test gives nada.
print_r($test);
}
}
else
{
$this->data['content'] = "form";
$this->load->view('templates/standard', $this->data);
}
}
//function I'm wrestling form input : <?php echo form_upload('userfile', ''); ?>
function do_upload()
{
$config['upload_path'] = './assets/temp/applications/';
$config['allowed_types'] = 'txt|odt|doc|pdf';
$config['max_size'] = '100';
$config['xss_clean'] = TRUE;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
return $error; //test
}
else
{
$data = array('upload_data' => $this->upload->data());
return TRUE; //test
}
}
Edit, What am I doing wrong here?