• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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.

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.

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.


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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.