Welcome Guest, Not a member yet? Register   Sign In
Unable to find a post variable called userfile
#1

[eluser]PHP Programmer[/eluser]
I am getting the following error on uploading the files:
"Unable to find a post variable called userfile"

Although, I have assigned the following:

<input type="file" name="userfile1" id="userfile1" />
<td>&lt;input type="file" name="userfile2" id="userfile2" /&gt;&lt;/td>
<td>&lt;input type="file" name="userfile3" id="userfile3" /&gt;&lt;/td>
<td>&lt;input type="file" name="userfile4" id="userfile4" /&gt;&lt;/td>
<td>&lt;input type="file" name="userfile5" id="userfile5" /&gt;
&lt;input type="file" name="userfile6" id="userfile6" /&gt;
&lt;input type="file" name="userfile7" id="userfile7" /&gt;

How can I remove that error??
#2

[eluser]xwero[/eluser]
file inputs are stored in the $_FILES global.
#3

[eluser]PHP Programmer[/eluser]
After that, I did the following in controller:

$config['upload_path'] = './uploads/Employer/Photo/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '2048'; //2 meg
$this->load->library('upload', $config);
foreach($_FILES as $key => $value)
{
//print_r($value);
if( ! empty($key))
{
$this->upload->initialize($config);
if ( ! $this->upload->do_upload($key))
{
echo "here";
print_r($errors[] = $this->upload->display_errors());
}
else
{
echo "this";
$data = array('upload_data' => $this->upload->data());
//$this->Process_image->process_pic();
}
}
}

And, it always goes in error message. How to resolve this??
#4

[eluser]llbbl[/eluser]
the userguide helps alot . did you try rereading it?

if your still stuck i'll try to debug your code. you should get in habit of trying to problem solve and figure it out for yourself. you can't always rely on the forums. they become a bad crutch. Smile




Theme © iAndrew 2016 - Forum software by © MyBB