Of course by that I mean I'm doing something wrong with it. I posted a question before similar to this one and got some answers. Well based on those answers (I wasn't using CI's class now I am) I'm having a new problem. Any help would be appreciated.
PHP
public function do_upload () {
$scopeId = $this->input->get('id');
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|pdf';
$config['max_size'] = '1000';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload()) {
$error = array('error' => $this->upload->display_errors());
echo 'error'; <----- This is what is showing up
// uploading failed. $error will holds the errors.
} else {
$data = array('upload_data' => $this->upload->data());
// uploading successfull, now do your further actions
redirect(site_url('discovery/scopeDetails?scID='.$scopeId.''));
}
echo $error;
}
HTML Form
<div id="upload">
<?=form_open_multipart('discovery/do_upload');?>
<input name="userfile" size="40" type="file" />
<input type="submit" value="Upload" />
</div>
With the form i usually would just use straight HTML but I tried doing EXACTLY what http://codeigniter.com/user_guide/libraries/file_uploading.html told me to do.
Most likely the problem is your upload folder. Make sure it exists and set it's permissions to 777.
If that's not the problem then use print_r($error)
to see what's wrong.