Codeigniter - Attach a file from CDN
I am trying to attach a file from from my website using pulling from my CDN using CodeIgniter. It does not attach I am assuming because cross domain security issue. How can I attach a file using CodeIgniter from another server that I have control over?
$this->load->helper('email');
$this->email->from('services@domain-name.com');
$this->email->to($this->input->post('email'));
$retval = $this->crud_model->read('posts', $post_id);
$post = $retval[0];
开发者_运维知识库$this->email->subject($post->title);
$this->email->message('Location: '.$this->config->item('cdn_media_url').$post->image_path);
$this->email->attach($this->config->item('cdn_media_url').$post->image_path);
Thanks.
You can't attach HTTP Location headers and URLs to e-mail. That just doesn't make sense.
Download the image from your CDN with file_get_contents
or cURL
, then you can provide its local path on your server in the code.
精彩评论