Welcome Guest, Not a member yet? Register   Sign In
issue with uploader


I am trying to understand the uploader.  I have a uploader.php with the config in and it does work if I break the code inside it, so I know its being loaded.

I have this process at the moment and it works and adds the bit to the database but its not uploading the image.

PHP Code:
public function upload_image_process(){
= array(
'name' => $this->input->post('image_name')
(is_array($data) && count($data)>0){
             $this->session->set_flashdata('message''Image uploaded.');
} else {

I feel i am not using it right but I have looked at the docs and I cannot see any issue.



you are not showing your code - you have to create the configs and load the upload library with the configs.

the most common issue is that you have not changed the permissions on the folder you are trying to upload to.
otherwise i would google for a tutorial that will take you step by step.

The config is being auto loaded in uploader.php as stated above which is in the tutorial in the docs, the folder is also set to 777 as in the docs.

(This post was last modified: 04-07-2016, 04:57 PM by PaulD. Edit Reason: Type )

You are redirecting to the admin/dashboard in all circumstances, but you could be missing an error message.

Try doing something like:
PHP Code:
if ( ! $this->upload->do_upload($upload_image))

  $error $this->upload->display_errors('''');
  show_error('Upload Errors: '.$error401'Upload Error');

Perhaps your path/to/directory is not set correctly, or it is the image type, or the size etc etc. You should always be checking and reporting back to the user when an error occurs. Otherwise, how do you or the user know what is going on?

Hope that helps,


PS Am just using the 'show_error' for simplicity here, it is a quick solution while testing or developing. Of course normally you would have a user error view and/or error logging in place of some description.

(This post was last modified: 04-08-2016, 12:30 PM by doomie22. Edit Reason: added php code )

I am getting the following error.

Upload Errors: You did not select a file to upload.

This is the form section of it.

PHP Code:
<?php echo form_upload(array('id' => '1''name' => 'upload_image''class' => 'form-control')); ?>

I really have no idea why it is saying that as I have unless it's not pulling it to the process.

(This post was last modified: 04-08-2016, 12:48 PM by PaulD. Edit Reason: Missed your quote: added new suggestion )


OK, at least you have an idea now of why your file is not uploading. It is probably a field name error. I see in your controller you are referring to

PHP Code:


PHP Code:

Check what the name of your file input field actually is.

Hope that helps,


PS Just noticed you quoted your form section above. Can you paste the HTML of the form that is being generated?

Try this: Change
PHP Code:

PHP Code:

again its easier to help you if you show all your code. the form open needs to be multipart

the form field needs to be type=file
<input type="file" name="filename" size="20" />

Theme © iAndrew 2016 - Forum software by © MyBB