如何在codeigniter中附加文件

How to attach a file in Codeigniter mail class?

 <input type="file" class="default" name="attach">

In my controller:

$this->load->library('email');
                $this->email->set_mailtype("html");
                $this->email->set_newline("
");
                $this->email->from('admin@admin.com'); 
                $this->email->to($emailid);// change it to yours
                $this->email->subject($subject);
                $this->email->message($message);
                $this->email->attach();
                $this->email->send();

I dont know what to give inside the attach().

you can follow this url for email reference in codeigniter email sending with codeIgniter

$this->email->attach('/path/to/photo1.jpg');
$this->email->attach('/path/to/photo2.jpg');
$this->email->attach('/path/to/photo3.jpg');

$this->email->send();

You have to enter PATH of the attachment in attach function like $this->email->attach('/path/to/attachment');

And if you want to add more than one file repeat the same line.

Note that path should not be URL.

Use This:-

$this->email->attach('/path/to/photo1.jpg');

Click On This link for Full details about email function