CI 묻고 답하기

제목 input->get_post();
글쓴이 똘망이 작성시각 2013/08/20 11:52:21
댓글 : 14 추천 : 0 스크랩 : 0 조회수 : 18115   RSS

컨트롤러에서

$file_name = $this->input->get_post('file_name');

이렇게 햇는데 아무것도 저장이 안되네요ㅠㅠ

$file_name = $_REQUEST['file_name'];

이렇게 했을때는 file_name이 저장이 됩니다..ㅠ

php 5.3.3에 ci 2.1.0으로 업글했습니다

업글하면서 CI_Controller, parent:: __construct(); 수정했구요(모델도 수정했습니다.)

ㅠㅠ 왜 get_post를 못하는건지 알고 싶습니다.. 제가 틀리게 한건지..ㅠ
 

 다음글 헤더 풋더 나누기.. (8)
 이전글 컨트롤러 부분입니다 ㅠㅠ (10)

댓글

변종원(웅파) / 2013/08/20 11:56:43 / 추천 0
get으로 보낸건가요? post로 보낸건가요? 상황에 따라 GET이 막혀있을 수 있습니다
들국화 / 2013/08/20 12:00:48 / 추천 0
form 이 틀린듯 하네요.
문법책부터 차근히 보셔야 할것 같네요.
똘망이 / 2013/08/20 12:03:09 / 추천 0

질문드린 부분은 get으로 보낸건데요..ㅠ

이미지 파일명을 보낸겁니다..

예를 들면 da6c5c9db7dc18c671a47de62fd1247c.png 이런식이구요..ㅠ

근데 이것뿐만 아니라 모든 get과 post가 안되는것 같더라구요 ㅠㅠ

들국화 / 2013/08/20 13:56:28 / 추천 0
$config['uri_protocol'] = 'REQUEST_URI';
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-?';
$config['enable_query_strings'] = TRUE;

똘망이 / 2013/08/20 17:13:15 / 추천 0

config 설정 바꿧는데요 여전히 안되네요....ㅠ

 

변종원(웅파) / 2013/08/20 17:29:09 / 추천 0
서버에 일반php 파일로 폼전송 하는 것 만들어서 테스트 해보세요.
(된다면 ci만의 문제.)

전송하는 뷰 소스와 받는 컨트롤러 부분 소스 올려주세요.

config.php 내용도요

똘망이 / 2013/08/20 17:46:44 / 추천 0

말씀해주신대로 테스트 해보았는데 post는 잘 받아오는것 같습니다;;;;;

get만 못받아오네요ㅠㅠ

전송하는 부분
<img src=\"/?c=common&m=download&file_name=".$raw_name.$file_ext."&orig_name=".$orig_name."&mcd=".$mcd."\" alt=\"".$orig_name."\" border=\"0\"  id=\"here\" width=\"".$width."\" height=\"".$height."\"/>

받는 부분
$file_name = $this->input->get_post('file_name'); //실제저장명
$orig_name = $this->input->get_post('orig_name'); //원본파일명 
$mcd       = $this->input->get_post('mcd');

이렇게 되어있습니다...

똘망이 / 2013/08/20 17:54:16 / 추천 0

function get($index = NULL, $xss_clean = FALSE)
 {
  // Check if a field has been provided
  if ($index === NULL AND ! empty($_GET))
  {
   $get = array();

   // loop through the full _GET array
   foreach (array_keys($_GET) as $key)
   {
    $get[$key] = $this->_fetch_from_array($_GET, $key, $xss_clean);
    print_r($get[$key]);
   }
   return $get;
  }

  return $this->_fetch_from_array($_GET, $index, $xss_clean);
 }

get펑션이구요
 if ($index === NULL AND ! empty($_GET))
이 if문을 타야하는데 못타고 있는것 같습니다..ㅠ

똘망이 / 2013/08/20 17:58:43 / 추천 0
$config['base_url'] = "http://localhost/";
$config['index_page'] = "";
$config['uri_protocol'] = "PATH_INFO";
$config['url_suffix'] = "";
$config['language'] = "english";
$config['charset'] = "UTF-8";
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = 'IW_';
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-?';
$config['enable_query_strings'] = TRUE;
$config['controller_trigger']  = 'c';
$config['function_trigger']  = 'm';
$config['directory_trigger']  = 'd'; // experimental not currently in use
$config['log_threshold'] = 3;
$config['log_path'] = '..........';
$config['log_date_format'] = 'Y-m-d H:i:s';
$config['cache_path'] = '';
$config['encryption_key'] = "kim";
$config['sess_cookie_name']  = 'ci_session';
$config['sess_expiration']  = 7200;
$config['sess_encrypt_cookie'] = FALSE;
$config['sess_use_database'] = FALSE;
$config['sess_table_name']  = 'ci_sessions';
$config['sess_match_ip']  = FALSE;
$config['sess_match_useragent'] = TRUE;
$config['sess_time_to_update']  = 300;
$config['cookie_prefix'] = "";
$config['cookie_domain'] = "";
$config['cookie_path']  = "/";
$config['global_xss_filtering'] = array('TRUE', 'POST', 'GET'); 
$config['compress_output'] = FALSE;
$config['time_reference'] = 'local';
$config['rewrite_short_tags'] = FALSE;
$config['proxy_ips'] = '';
$config['upload_path']     = '........'; //업로드 경로
$config['upload_max_size'] = 10 * 1024;                            //업로드 최대 사이즈
config 내용입니다. 주석지우고 경로들 지우고 올립니다..
들국화 / 2013/08/20 18:16:05 / 추천 0
$config['uri_protocol'] = "PATH_INFO";

이값을 바꿔 보세요.
똘망이 / 2013/08/20 18:17:24 / 추천 0
마찬가지입니다...ㅠㅠ post는 받아오는데 get은 어째서 못받아오는지.. 알수가 없네요...ㅠ
똘망이 / 2013/08/20 19:10:28 / 추천 0

ㅠㅠ 해결 되었습니다...

 

/*
  if ($this->_allow_get_array == FALSE)
  {
   $_GET = array();
  }
  else
  {
  */
   if (is_array($_GET) AND count($_GET) > 0)
   {
    foreach ($_GET as $key => $val)
    {
     $_GET[$this->_clean_input_keys($key)] = $this->_clean_input_data($val);
    }
   }
  /*
  }
  */

이렇게 주석을 거니까 되네요ㅠㅠ
변종원(웅파) / 2013/08/20 23:02:57 / 추천 0
2.1.0버전에 1.7.2 config.php 그대로 복사하신 것은 아닌지요?

2.1.0버전에는 아래와 같은 항목이 있습니다. config.php 넣어보세요

$config['allow_get_array']      = TRUE; 
똘망이 / 2013/08/21 09:07:22 / 추천 0

감사합니다 ㅠㅠ 웅파님이 말씀해주신데로 해도 되네여 ㅠㅠ