title: Codeigniter image upload and path to database
body: <p>I'm having a bit of a problem trying to make an upload form in codeigniter.
  Not sure what I am doing wrong, everything else is getting correctly in the database. I looked in the documentation and tried several things but I'm not getting any further.. Any feedback is very much appreciated!<br>
  Thanks in advance.</p>
  
  <p>model:</p>
  
  <pre><code>public function set_newstudent()
      {
          $this-&gt;load-&gt;helper('url');
  
          $slug = url_title($this-&gt;input-&gt;post('naam'), 'dash', TRUE);
  
                   $config['upload_path'] = '/file_path/';
                   $config['allowed_types'] = 'gif|jpg|png|jpeg';
                   $this-&gt;load-&gt;library('upload', $config);
                   $this-&gt;upload-&gt;data('full_path'););
                   $data_upload_files = $this-&gt;upload-&gt;data();
  
                   $image = $data_upload_files[full_path];
  
                   $data = array(
  
              'naam' =&gt; $this-&gt;input-&gt;post('naam'),
              'voornaam' =&gt; $this-&gt;input-&gt;post('voornaam'),
              'id' =&gt; $slug,
              'text' =&gt; $this-&gt;input-&gt;post('text'),
              'picture'=&gt;$this-&gt;input-&gt;post('picture')
      );
  
          return $this-&gt;db-&gt;insert('student', $data);
      }
  </code></pre>
  
  <p>controller:</p>
  
  <pre><code>public function create()
              {
                  $this-&gt;load-&gt;helper('form');
                  $this-&gt;load-&gt;library('form_validation');
  
                  $data['title'] = 'Create a new Student';
  
                  $this-&gt;form_validation-&gt;set_rules('naam', 'Naam', 'required');
                  $this-&gt;form_validation-&gt;set_rules('voornaam', 'Voornaam', 'required');
                  $this-&gt;form_validation-&gt;set_rules('text', 'Text', 'required');
  
                  if ($this-&gt;form_validation-&gt;run() === FALSE)
                      {
                      $this-&gt;load-&gt;view('templates/header', $data);
                      $this-&gt;load-&gt;view('students/create');
                      $this-&gt;load-&gt;view('templates/footer');
  
                      }
                  else
                      {
                      $this-&gt;student_model-&gt;set_newstudent();
                      $this-&gt;load-&gt;view('students/success');
                      }
              }
  </code></pre>
  
  <p>view:</p>
  
  <pre><code>&lt;?php echo validation_errors(); ?&gt;
  
  
  &lt;?php echo form_open_multipart('student/create');?&gt;
  
  &lt;div class="form-group"&gt;
  &lt;label for="naam"&gt;Naam&lt;/label&gt;&lt;br&gt;
  &lt;input type="input" name="naam" class="form-control" /&gt;&lt;br /&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
  &lt;label for="voornaam"&gt;Voornaam&lt;/label&gt;&lt;br&gt;
  &lt;input type="input" name="voornaam" class="form-control"/&gt;&lt;br /&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
  &lt;label for="text"&gt;Vertel iets over jezelf:&lt;/label&gt;&lt;br&gt;
  &lt;textarea name="text" class="form-control" rows="5"&gt;&lt;/textarea&gt;&lt;br /&gt;
  &lt;/div&gt;
  
  &lt;div class="form-group"&gt;
  &lt;label for="text"&gt;Kies een profiel foto:&lt;/label&gt;&lt;br&gt;
  &lt;input type="file" name="userfile"  class="btn btn-default btn-file" /&gt;
  
  &lt;/div&gt;
  &lt;input type="submit" class="btn btn-success" name="submit" 
  value="Create student" style="width:100%;margin-bottom:1%" /&gt;
  
  &lt;/form&gt;
  </code></pre>