[eluser]mooders[/eluser]
Hi,
I am trying to upload a file, but the upload code in my controller is failing and displaying the following error: 'Status codes must be numeric'. I have tracked the issue down to the upload code, so relevant extracts from the view and controller follow:
View:
Code:
<?php echo form_open_multipart('profile/add'); ?>
<div id="padded">
<label class="mylabelstyle">Photo: <span id="littleText">250Kb max file size; max 1024 x 768</span><br />
<input type="file" name="photo" class="myinputstyle" />
</div>
Controller:
Code:
//get photo upload
$config['upload_path'] = '/img/userphotos/';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['max_size'] = '250';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if (!$this->upload->do_upload()){
show_error('error', $this->upload->display_errors());
} else {
$data = array('photo_upload' => $this->upload->data());
$photo_name = $data['photo_upload']['file_name'];
$photo_name .= $userid;
}
It's the
Code:
!$this->upload->do_upload()
condition in the Controller that's triggering the error.
The upload folder has write permissions and the file to be uploaded conforms to the $config rules. The error message doesn't appear to give much of a clue as to what is wrong...
Anyone with any ideas, please?
Many thanks,
Neil