Welcome Guest, Not a member yet? Register   Sign In
File Upload Error


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:

<?php echo form_open_multipart('profile/add'); ?>
<div id="padded">
    <label class="mylabelstyle">Photo:&nbsp;<span id="littleText">250Kb max file size; max 1024 x 768</span><br />
    &lt;input type="file" name="photo" class="myinputstyle" /&gt;

//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
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,



status codes are server centric from the little googling that I have done. but why don't you remove the show_error() function and just try echoing the $this->upload->display_errors() and see.

Just a thot?!

Theme © iAndrew 2016 - Forum software by © MyBB