Reputation: 421
I'm using mailgun to parse incoming emails. mailgun sends the parsed emails to a URL (https://example.com/email).
I'm able to fetch the from, to, subject, body etc. However I'm not able to fetch the attachments.
Below is my code and it returns a null value.
$file = addslashes(file_get_contents($this->input->post('attachment-1'))['name']);
$result = $this->tickets_model->saving_files($file);
Please help me out.
thanks.
Upvotes: 2
Views: 417
Reputation: 2446
The way I've gotten this to work is to use the CI upload library to first upload the file and then parse it.
$config['file_name'] = 'filename';
$config['upload_path'] = '/upload/path';
$this->load->library('upload', $config);
if (!$this->upload->do_upload('attachment-1')) {
// fail
} else {
// success
}
Upvotes: 1