Codeigniter empty $_POST & $_FILES Codeigniter empty $_POST & $_FILES codeigniter codeigniter

Codeigniter empty $_POST & $_FILES


Most probable cause for this is bad mod rewrite rules. If you are using any, try disabling them and post your data again.


I'm using the input class in conjunction with regular $_POST variables and it has always worked for me. The theory that CI cleans out post variables doesn't add up when he can dump them in regular forms.

Turn off csrf protection and please let us know the results. Use firebug console to read the answer from the server.For a workaround regarding csrf I use https://github.com/EllisLab/CodeIgniter/pull/236

CodeIgniter also has issues with file types.http://codeigniter.com/forums/viewthread/113029

I have the working libraries for both, if you want them just drop me a message.


First of all, you should check that you have a form tag for enctype.

add enctype="multipart/form-data" to form as it supports uploading.

It will work, can you try and put both the print_r function after else tag before $data,It will run once the if () condition satisfies. So add it in the else tag and run it.

function do_upload(){                $config['upload_path'] = 'incoming/';    $config['allowed_types'] = 'pdf|doc|docx|rtf|txt';    $config['max_size'] = '900';    $this->load->library('upload');    $this->upload->initialize($config); // MUST CALL ELSE config not loaded    if ( ! $this->upload->do_upload()) {        $error = array('error' => $this->upload->display_errors());        $this->load->view('upload_form', $error);    }    else {           print_r($_POST);            print_r($_FILES);        $data = array('upload_data' => $this->upload->data());                    $this->load->model('translation_model');                    $this->translation_model->add_orig($job, $filePath);        $this->load->view('upload_success', $data);    }}