title: Ckeditor upload image return 403 forbidden error on codeigniter
body: <p>I'm using ckeditor with codeigniter;</p>
  
  <pre><code>CKEDITOR.editorConfig = function( config ) {
  
  
    config.width = '68%';
  
    config.toolbarGroups= [
  
  {name:"styles","groups":["styles"]},
  {name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
  {name: "links"},
  {name: "paragraph", groups: [ 'list', 'indent', 'blocks', 'align'] },
  '/',
  {name: 'colors' },
  {name: 'clipboard', groups: [ 'clipboard', 'undo' ] },
  {name:"insert","groups":["insert"]},
    ];
  
    config.extraPlugins = 'mathjax,codesnippet,autogrow,colordialog,tableresize';
  
    config.codeSnippet_theme = 'zenburn';
  
    config.autoGrow_maxHeight = 600;
  
  
   config.filebrowserUploadUrl = '../Ckeditor/do_upload';
  };
  </code></pre>
  
  <p>this is the config.js file of Ckeditor</p>
  
  <pre><code>class Ckeditor extends CI_Controller{
  
    public function __construct(){
  
  parent::__construct();
  $this-&gt;load-&gt;helper('url');
  $this-&gt;load-&gt;helper('form');
  }
  
    public function do_upload(){
  
  $config['upload_path'] = './resources/uploads/';
  
  $config['allowed_types'] = 'gif|jpg|jpeg|png';
  
  $this-&gt;load-&gt;library('upload');
  $this-&gt;upload-&gt;initialize($config);
  
  $funcNum = $this-&gt;input-&gt;get('CKEditorFuncNum');
  
  if ( ! $this-&gt;upload-&gt;do_upload('upload')){
      $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
      $message = 'fail';
      $url = '';
  }
  else
  {
     $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data());
     $message = 'success';
     $url = base_url().'resources/uploads/'. $this-&gt;upload-&gt;data()['file_name'];
  }
  
  echo "&lt;script type='text/javascript'&gt;window.parent.CKEDITOR.tools.callFunction($funcNum, '$url', '$message');&lt;/script&gt;";
   }
  
    public function index(){
  
  echo 'this page is used for file upload';
  $this-&gt;load-&gt;view('form', array('error' =&gt; ''));
  
    }
   }
  </code></pre>
  
  <p>the do_upload works fine when I'm using  ,but for the CKeditor each time I'm try to upload an image .I get a 403 POST </p>
  
  <pre><code>http://localhost/ci/index.php/admin/Ckeditor/do_upload?CKEditor=editor1&amp;CKEditorFuncNum=1&amp;langCode=zh-cn 403 (Forbidden)
  </code></pre>
  
  <p>how to solve this problem, it's already annoy me for a day..Is it because of lack of this hidden fields?</p>
  
  <pre><code>&lt;input type="hidden" name="csrf_test_name" value="3be92cbaaba15d7d08dd7affad23abfd" style="display:none;" /&gt;
  </code></pre>
  
  <p>but how can i make ckeditor to work.cause apprently I can't control the form ckeditor generated to upload image?</p>
  
  <p>_____________________________update_____________________________________________</p>
  
  <p>when I set the </p>
  
  <pre><code>$config['csrf_protection'] = FALSE;
  </code></pre>
  
  <p>in the codeigniter's config.php. I don't have problem upload image.but I want that set to TRUE.</p>
  
  <pre><code>/*
  |--------------------------------------------------------------------------
  | Cross Site Request Forgery
  |--------------------------------------------------------------------------
  | Enables a CSRF cookie token to be set. When set to TRUE, token will be
  | checked on a submitted form. If you are accepting user data, it is strongly
  | recommended CSRF protection be enabled.
  |
  | 'csrf_token_name' = The token name
  | 'csrf_cookie_name' = The cookie name
  | 'csrf_expire' = The number in seconds the token should expire.
  | 'csrf_regenerate' = Regenerate token on every submission
  | 'csrf_exclude_uris' = Array of URIs which ignore CSRF checks
  */
  $config['csrf_protection'] = TRUE;
  $config['csrf_token_name'] = 'csrf_test_name';
  $config['csrf_cookie_name'] = 'csrf_cookie_name';
  $config['csrf_expire'] = 7200;
  $config['csrf_regenerate'] = TRUE;
  $config['csrf_exclude_uris'] = array();
  </code></pre>
  
  <p>So my problem may be temporary disable the csrf_protection on the Codeigniter.
  but why should I temporary disable that?
  Is there other way to solve the problem instead of disable the csrf_protection on a single url like below.</p>
  
  <pre><code>$config['csrf_exclude_uris'] = array(
    'admin/Ckeditor/do_upload',
    ''
  );
  </code></pre>