title: Profile Image will upload to folder but not to screen
body: <p>I'm creating a profile page where when I select an image to upload it will be stored in the uploads folder but will not display to the screen - why would this be.</p>
  
  <p>The container of an image seems to appear, but not the image</p>
  
  <p>But the upload function does correctly thtow back an error if I don't select an image to upload</p>
  
  <p>Here is my controller with the upload feature within it - i realise the folder is called puploads:</p>
  
  <pre><code> class HomeProfile extends CI_Controller 
    {
  
  
   function HomeProfile()
   {
     parent::__construct();
     $this-&gt;load-&gt;model("profiles");
     $this-&gt;load-&gt;model("profileimages");
      $this-&gt;load-&gt;helper(array('form', 'url'));
   }
  
  
     function upload()
      {
      $config = array(
  
          'allowed_types' =&gt;'gif|jpg|jpeg|png',
          'upload_path' =&gt;'./web-project-jb/assets/puploads/',
           'max_size' =&gt; 10000,
           'max_width' =&gt; 1024,
          'max_height' =&gt; 768
  
  );
  
  
  $this-&gt;load-&gt;library('upload', $config);
  $img = $this-&gt;session-&gt;userdata('img');
  $username = $this-&gt;session-&gt;userdata('username');
  $this-&gt;profileimages-&gt;putProfileImage($username, $this-&gt;input-&gt;post("profileimage"));
  //fail show upload form
  if (! $this-&gt;upload-&gt;do_upload())
  {
  
      $error = array('error'=&gt;$this-&gt;upload-&gt;display_errors());
  
      $username = $this-&gt;session-&gt;userdata('username');
  
  
      $viewData['username'] = $username;
      $viewData['profileText'] = $this-&gt;profiles-&gt;getProfileText($username);
  
      $this-&gt;load-&gt;view('shared/header');
      $this-&gt;load-&gt;view('homeprofile/homeprofiletitle', $viewData);
      $this-&gt;load-&gt;view('shared/nav');
      $this-&gt;load-&gt;view('homeprofile/homeprofileview', $error, $viewData, array('error' =&gt; ' ' ));
      $this-&gt;load-&gt;view('shared/footer');
  
      //redirect('homeprofile/index');
  
  }
  
  else
  {
      //successful upload so save to database
  
  
      $file_data = $this-&gt;upload-&gt;data();
  
  
      $data['img'] = base_url().'./web-project-jb/assets/puploads/'.$file_data['file_name'];
      // you may want to delete the image from the server after saving it to db
      // check to make sure $data['full_path'] is a valid path
      // get upload_sucess.php from link above
      //$image = chunk_split( base64_encode( file_get_contents( $data['file_name'] ) ) );
  
  
  
      $this-&gt;username = $this-&gt;session-&gt;userdata('username');
  
      $data['profileimages'] = $this-&gt;profileimages-&gt;getProfileImage($username);
  
  
      $viewData['username'] = $username;
      $viewData['profileText'] = $this-&gt;profiles-&gt;getProfileText($username);
  
      $username = $this-&gt;session-&gt;userdata('username');
  
      $this-&gt;load-&gt;view('shared/header');
      $this-&gt;load-&gt;view('homeprofile/homeprofiletitle', $viewData);
      $this-&gt;load-&gt;view('shared/nav');
      $this-&gt;load-&gt;view('homeprofile/homeprofileview', $data, $viewData);
      $this-&gt;load-&gt;view('shared/footer');
  
  
      //redirect('homeprofile/index');
          }
  
     }
  
  
  
       function index()
       {
  
  $username = $this-&gt;session-&gt;userdata('username');
  
  $data['profileimages'] = $this-&gt;profileimages-&gt;getProfileImage($username);
  
  $viewData['username'] = $username;
  $viewData['profileText'] = $this-&gt;profiles-&gt;getProfileText($username);
  
  $this-&gt;load-&gt;view('shared/header');
  $this-&gt;load-&gt;view('homeprofile/homeprofiletitle', $viewData);
  $this-&gt;load-&gt;view('shared/nav');
  //$this-&gt;load-&gt;view('homeprofile/upload_form', $data);
  $this-&gt;load-&gt;view('homeprofile/homeprofileview', $data, $viewData, array('error' =&gt; ' ' ) );
  $this-&gt;load-&gt;view('shared/footer');
    }
  
    }
  </code></pre>
  
  <p>Here is my profileimages model:</p>
  
  <p>
  
  <pre><code>function ProfileImages()
  {
      parent::__construct();
  
  }
  
  function exists($username)
  {
      $this-&gt;db-&gt;select('*')-&gt;from("profileimages")-&gt;where('user', $username);
      $query = $this-&gt;db-&gt;get();
  
      if ($query-&gt;num_rows() &gt; 0)
      {
  
          return true;
          /*
           echo "user $user exists!";
          $row = $query-&gt;row();
          echo " and his profileimage is $row-&gt;profileimage";
          */
      }
  
      else
  
      {
  
          return false;
          //echo "no such user as $user!";
      }
  
  }
  
  
  function putProfileImage($username, $img)
  {
  
  
      $record = array('user' =&gt; $username, 'profileimage' =&gt; $img);
      if ($this-&gt;exists($username))
      {
          $this-&gt;db-&gt;where('user', $username)-&gt;update('profileimages', /*'./uploads/.' */$record);
  
          //appends
      }
      else
      {
          $this-&gt;db-&gt;where('user', $username)-&gt;insert('profileimages', $record);
  
      }
  
  }
  
  function getProfileImage($username)
  {
      $this-&gt;db-&gt;select('*')-&gt;from('profileimages')-&gt;where('user', $username);
      $query = $this-&gt;db-&gt;get();
      if ($query-&gt;num_rows() &gt; 0){
          $row = $query-&gt;row();
          return $row-&gt;profileimage;
      }
  
      return Null;
  
  
  }
  
  }
  </code></pre>
  
  <p>Here is my view:</p>
  
  <pre><code>&lt;h3&gt;&lt;?="Profile Image"?&gt;&lt;/h3&gt;
   &lt;img src="./web-project-jb/assets/puploads/" width='300' height='300'/&gt;
    &lt;?=form_open_multipart('homeprofile/upload');?&gt;
      &lt;input type="file" name="userfile" value=""/&gt;
      &lt;?=form_submit('submit', 'upload')?&gt;
      &lt;?=form_close();?&gt; 
      &lt;?php if (isset($error)) echo $error;?&gt;
     &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>I have tried replacing the img src with  but I just get an error back saying data is unrecognised</p>