[eluser]TheFuzzy0ne[/eluser]
Indeed, I can.
Code:
$config['upload_path'] = '/usr/local/var/www/Test/ci/uploads/';
$config['allowed_types'] = 'txt|pdf';
$config['overwrite'] = TRUE;
$config['encrypt_name'] = TRUE;
$this->load->library('upload');
foreach ($_FILES as $key => $value) { // Loop through each file in the $_FILES array.
if (!empty($key['userfile'])) {
$this->upload->initialize($config); // Set up the upload library configuration (probably best done BEFORE the loop).
if (!$this->upload->do_upload($key)) { // Show a view if the upload of a SINGLE file fails. Is this a partial, or a full page?
$data['main_content'] = 'emailsystem/emails_view';
$data['error'] = $this->upload->display_errors('<p class="error">', '</p>');
$this->load->view('includes/no_js/template', $data);
} else { // We made it thus far, all is good. Yippee!
$return = $this->upload->data();
// Blah, blah, blah
$this->email->attach($file); Attach the CURRENT FILE ONLY
if (!$this->email->send()) { // If sending the mail fails, load a view. Is this a partial, or an entire page? I don't know...
$this->emailview();
} else {
$this->session->set_flashdata('emailview', 'Email Sent To ' . $email . '. With A Number ' . $anum . '');
redirect('email_controller/emailview', 'location'); // Redirect after sending a single file. Are we still in the loop? I think so!
// This should be OUTSIDE of the loop.
}
}
}
}