Codeigniter form_open_multipart() displays blank in V2.2.0

1.3k views Asked by At

I am using latest version (V2.2.0) of codeigniter and wanted to create a very simple single file upload using the upload class. However I keep getting a blank page when trying to create a form using form_open_multipart and use $this->input->post() as post array. But when I use $_POST everything is fine. I've been looking around, but I can't seem to find out how to make this work. I also load the form helper ($this->load->helper('form');) The HTML uploadPage.php

<body>
<?php echo form_open_multipart('upload/theUpload');?>
<input type="file" name="userfile">
<input type="submit" name="submit" value="Upload File">
</form>
</body>
1

There are 1 answers

1
Lakhan On

$this->input->post() is obliviously return the false because you are not mentioning the name of which value you want to retrieve using post.Make changes here in your code :

if(isset($_POST))

or

if(!empty($_POST))

See POST

you can also do this:

if($this->input->post('userfile'))//userfile is the name of post variable