Sending email through contact form with file attachment

I’m trying to create a contact form using Codeigniter that will send an email with a file attachment. Right now when the email is sent, all I get is the name of the file that was uploaded and not the actual attachment. Can someone help me out?

Here is the code I’m using:

[php]

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class sendmail_contact extends CI_Model { function __construct() { parent::__construct(); } function send() { $this->load->library('email'); $this->load->helper('date'); $now = time(); $contact_date = unix_to_human($now); // U.S. time, no seconds $this->load->library('email'); $this->email->set_newline("\r\n"); $name = $this->input->post('name', TRUE); $file = $this->input->post('file', TRUE); $this->email->from($email); $this->email->to('[email protected]'); $this->email->subject('Subject'); $this->email->message("Email" . $name . "\r\n" . $file); $this->email->send(); } [/php]
Sponsor our Newsletter | Privacy Policy | Terms of Service