Welcome Guest, Not a member yet? Register   Sign In
Uploads, with email confirmation
#1

[eluser]timj[/eluser]
Perhaps I am just not getting it. I want my Uploads utility to send an email confirmation to the webmaster that a file has indeed been uploaded. The following code does not seem to cut it. In fact, it breaks the upload_success View file (the file uploads, it just breaks the View). Pointers?

class Upload extends Controller {

function Upload()
{
parent::Controller();
$this->load->helper(array('email','form','url'));
}

function index()
{
$this->load->view('upload/upload_form', array('error' => ' ' ));
}

function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '';
$config['max_width'] = '';
$config['max_height'] = '';

$this->load->library('upload', $config);

if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());

$this->load->view('upload/upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload/upload_success', $data);
$this->email->to('[email protected]', 'Webmaster');
$this->email->subject('A file has been added');

}
}
}


Messages In This Thread
Uploads, with email confirmation - by El Forum - 11-18-2009, 06:08 PM
Uploads, with email confirmation - by El Forum - 11-18-2009, 06:56 PM
Uploads, with email confirmation - by El Forum - 11-18-2009, 07:12 PM
Uploads, with email confirmation - by El Forum - 11-18-2009, 07:20 PM



Theme © iAndrew 2016 - Forum software by © MyBB