• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
attaching files with email class

The email debugger tells me the email sends but cannot find the file path for the attached file.

Is it possible for users to attach a file directly from their computer? or do I have to upload the file on my host then attach it?

function sendEmail() {
  $this->email->from( $this->input->post('email'), $this->input->post('name'));
  $this->email->to('[email protected]');
  $this->email->message( $this->input->post('comments') );
  echo $this->email->print_debugger();
} // end function

<form action="<?php echo base_url('main/sendEmail'); ?>" method="post">
        <label for="name">Full Name:</label>
        &lt;input type="text" id="name" name="name" /&gt;
        <label for="email">Email:</label>
        &lt;input type="email" id="email" name="email" /&gt;
        <label for="resume">Upload Resume:</label>
        &lt;input type="file" id="resume" name="resume" /&gt;
        <label for="comments">Comments:</label>
        &lt;textarea id="comments" name="comments" rows="5" cols="45"&gt;&lt;/textarea>
        &lt;input id="submit" type="submit" value="Submit" /&gt;
      </ul>&lt;!-- ul End --&gt;
&lt;/form&gt;&lt;!-- Form End --&gt;

Has anyone had success attaching files with the email class?


Files aren't accessible via $_POST.

You'll have to follow the process for saving an uploaded file, and then attaching that saved file by supplying the full saved file path (saved on your server), to the email::attach() method.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.