It is my first time to use codeigniter in building my school project.
Let me go straight.
I can get my POST request except for the form_upload();
This is my sample FORM:
<?php
echo form_open('admin/test_upload');
echo form_input(array('name' => 'title'));?><br/><?
echo form_upload(array('name' => 'file'));
echo form_submit(array('name' => 'submit', 'value' => 'submit'));
echo form_close();
?>
This is my CONTROLLER:
function test_upload(){
$data['header'] = "TEST UPLOAD";
var_dump($_POST) ; //basically, this is function echoes back the post array.
$this->load->view('admin/dashboard_view', $data);
}
This is the Output
array(2) {
["title"]=>
string(3) "asd"
["submit"]=>
string(6) "submit"
}
//The ["file"] is missing.... wHAT!?>
Can someone help me out?
File uploads need to have an
enctype="multipart/form-data"in their form tag, so you should be using this to open the form:Also, as the others have mentioned, the uploaded files will be in
$_FILESinstead of$_POST.