안녕하세요.
현재 이메일 관련되어서 파일 첨부 시에 파일도 함께 보내지는 이메일 작업을 진행 중입니다.
밑에 부분은 코딩된 내용입니다.
file_n이란 배열을 만들어서 해당 이미지들을 업로드 후에 attach로 파일 첨부해서 보내려고 합니다.
그런데 파일이 안받아와지네요 foreach 구문에 들어가지지 않아요. 혹시 잘못된 부분이 있나요?
<a id='file_0' name='file[]'> <br>파일:</a> <input type='file' id='file_n_0' name='file_n[]' size='4'/>
$return_name = $this->input->post('return_name');
$send_name = $this->input->post('send_name');
$subject = $this->input->post('subject');
$content = $this->input->post('content');
//$file = $this->input->post('file');
$this->load->library('email');
$email_setting = array('mailtype'=>'html');
$this->email->initialize($email_setting);
$this->email->from($send_name, $return_name);
$config['upload_path'] = $this->home_path.'/upfiles/email/';
$config['allowed_types'] = '*';
$config['max_size'] = '*';
$this->load->library('upload', $config);
$this->load->library('MY_Upload');
$this->upload->do_multi_upload('file_n');
$path_img = '/upfiles/email/';
$s_images = '';
foreach($this->upload->get_multi_upload_data() as $file):
$s_images .= $path_img.$file['file_name'].'||';
$this->email->attach($path_img.$file['file_name']);
endforeach;
$this->email->to($return_name);
$this->email->subject($subject);
$this->email->message($content);
$this->email->send();
echo "<script>alert('메일 발송이 완료되었습니다.');window.close();</script>"; }
제 기억이 맞다면
$this->upload->do_multi_upload('file_n');
이런 메소드는 없습니다.
사용자가 만든것으로 추정이 되어서 검색을 해보니
https://github.com/stvnthomas/CodeIgniter-Multi-Upload/blob/master/README.md
이사람이 만든걸로 보이네요.
코어 확장 하시고 사용 하세요.
참고하세요~