title: uploading images in codeigniter, is userfile required?
body: <p>I am using the function below to upload my image files to my server(Localhost). It is fine and image is being uploaded. But I need two image fields and hence both the images should be uploaded once the submit button is clicked. I used the function described here <strong><a href="https://stackoverflow.com/questions/9276756/codeigniter-multiple-file-upload">Codeigniter multiple file upload</a></strong> , but it is not working.</p>
  
  <p>I get this error message </p>
  
  <pre><code>A PHP Error was encountered
  
  Severity: Warning
  
  Message: is_uploaded_file() expects parameter 1 to be string, array given
  
  Filename: libraries/Upload.php
  
  Line Number: 161
  </code></pre>
  
  <p>Well I cannot understand where the error is.
  The function that I am using to upload single image is </p>
  
  <pre><code>function do_upload()
      {
          $config['upload_path'] = './uploads/';
          $config['allowed_types'] = 'jpeg|png|gif';
          $config['max_size'] = '0';
          $config['max_width']  = '0';
          $config['max_height']  = '0';
  
          $this-&gt;load-&gt;library('upload', $config);
  
          if ( ! $this-&gt;upload-&gt;do_upload())
          {
              $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors());
             //failed display the errors
          }
          else
          {
              //success
  
          }
      }
  </code></pre>
  
  <p>In addition I also like to ask can i change the input field name of my choice. i.e i always need to implement <code>&lt;input type="file" name="userfile"/&gt;</code> . Is it possible to change the name? I tried changing it and I get the message <strong>No file was selected</strong>, so that must mean that I cannot change it.</p>