개발 스크랩 메모/PHP
다운로드할 파일을 선택하지 않았습니다.PHP 코드 점화기
렉사이
2020. 12. 20. 23:57
post 기능을 시도하고, php 보기에서 메시지와 그림을 선택하고 싶습니다.
나의 메시지 기능이 양호하다.
하지만 사진을 올릴 때 오류를 받았는데 올릴 파일을 선택하지 않았습니다.
제 컨트롤러 기능이에요.
function post_func() { session_start(); echo $post_message=$_POST['post']; echo $share_with=$_POST['share_with']; echo $image=$_POST['image']; if($image==null){ echo "
no image
"; } else{ //////////////////////////////////////////////////////////////////////////////////////// $config['upload_path'] = './application/css'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '100'; $config['max_width'] = '1024'; $config['max_height'] = '768'; $this->load->library('upload', $config); $this->upload->initialize($config); if ( ! $this->upload->do_upload()) { $error = array('error' => $this->upload->display_errors()); echo "
"; echo $this->upload->display_errors(); echo "
image error
"; } else { echo "
reached
"; session_start(); $this->membership_model->insert_images($this->upload->data(),$email); $data = array('upload_data' => $this->upload->data()); echo "
"; } //////////////////////////////////////////////////////////////////////////////////////// } $public; if($share_with=="public"){ echo "1"; $public=true; }else{ echo "0"; $public=false; }echo "-----------------------------
"; echo $user=$this->session->userdata('user_identification'); $data = array ( 'userid'=> $user, 'public' => $public, 'message' => $post_message, 'picname' => "None" ); $this->load->model('membership_model'); $this->membership_model->add_message($data); echo ""; echo $user=$this->session->userdata('user_identification'); }
이것은 나의 관점이다.
//other view items 좀 도와주세요.
대답
변경: