서버에 이미지 파일을 업로드하고 싶습니다. & 데이터베이스에 이미지를 저장하고 싶습니다.codeigniter를 사용하여 이미지 파일을 업로드하는 방법은 무엇입니까?
데이터베이스에 이미지 파일을 저장하는 방법 &도 데이터베이스에서 이미지 파일을 가져올 수 있습니다. 이 문제를 해결하는 데 도움주세요.
프로젝트에서이 코드를 수행했습니다 ... 서버에서 업로드 할 때 upload_path를 찾을 수 없습니다. 컨트롤러 있음
$config['upload_path'] = base_url().'aplication/upload/'; // the uploaded images path
$config['allowed_types'] = 'jpg|jpeg|png';/*types of image extentions allowed to be uploaded*/
$config['max_size'] = '3048';// maximum file size that can be uploaded (2MB)
$this->load->library('upload',$config);
if (! is_dir($config['upload_path'])) /* this checks to see if the file path is wrong or does not exist.*/
{
echo($config['upload_path']);
die("THE UPLOAD DIRECTORY DOES NOT EXIST"); // error for invalid file path
$this->load->library('upload',$config); /* this loads codeigniters file upload library*/
}
if (!$this->upload->do_upload())
{
$error=array('error'=>$this->upload->display_errors());
//echo "UPLOAD ERROR ! ".$this->upload->display_errors(); //image error
// $this->load->view('main_view',$error);
}
else
{
$file_data=$this->upload->data();
$data['img']=base_url().'.application/upload/'.$file_data['file_name'];
echo("Image upload successfully..");
//================================================
// $this->load->model('insert_model');
// $this->insert_model->submit_image();
//==========================================
//$this->insert_model->insert_images($this->upload->data());
// $this->load->model('insert_model');
//$this->insert_model->submit_image();
}
[imageignoring with codeigniter] 중복 가능 (http://stackoverflow.com/questions/8942477/image-uploading-with-codeigniter) – Zoe