title: uploading an image in codeigniter trouble
body: <p>I have a code from the tutorial and i dont know what happen's why mine doesn't work. I just follow the tutorial and the code doesn't work. I am using a codeigniter framework, please help me with these, i have no error in console also, i dont know what's happening why . Also it doesn't sends a request from ajax. Please check the code in ajax. Thanks.</p>
  
  <p>ajax code:</p>
  
  <pre><code>$(function () {
    var inputFile = $('input[name=file]');
    var uploadURI = $('#form-upload').attr('action');
  
    $('#upload-btn').on('click', function(event) {
       var fileToUpload = inputFile[0].files[0];
       if(fileToUpload != 'undefine') {
          var formData = new FormData();
          formData.append("file", fileToUpload);
          $.ajax({
              url: uploadURI,
              type: "POST",
              data: formData,
              processData: false,
              contentData: false,
              success: function(data) {
                alert("Profile picture updated!");
              }
          });
       }
    });
  });
  </code></pre>
  
  <p>from view :</p>
  
  <pre><code>&lt;form action="&lt;?php echo site_url("profile/profile_picture") ?&gt;" id="form-upload"&gt;            
                &lt;div class="fileinput fileinput-new input-group" data-provides="fileinput"&gt;
                  &lt;div class="form-control" data-trigger="fileinput"&gt;&lt;i class="glyphicon glyphicon-file fileinput-exists"&gt;&lt;/i&gt; &lt;span class="fileinput-filename"&gt;&lt;/span&gt;&lt;/div&gt;
                  &lt;span class="input-group-addon btn btn-default btn-file"&gt;&lt;span class="fileinput-new"&gt;&lt;i class="glyphicon glyphicon-paperclip"&gt;&lt;/i&gt; Select file&lt;/span&gt;&lt;input type="file" name="file"&gt;&lt;/span&gt;
                  &lt;a href="#" id="upload-btn" class="input-group-addon btn btn-success fileinput-exists"&gt;&lt;i class="glyphicon glyphicon-open"&gt;&lt;/i&gt; Upload&lt;/a&gt;
                &lt;/div&gt;
              &lt;/form&gt;
  </code></pre>
  
  <p>controller:</p>
  
  <pre><code>public function profile_picture() {
          $config['upload_path'] = "./assets/uploaded_images/";
          $config['allowed_types'] = 'gif|jpg|png';
          $this-&gt;load-&gt;library('upload', $config);
  
          if($this-&gt;upload-&gt;do_upload("file")) {
  
          }
          else {
              echo "File cannot be uploaded";
          }
      }
  </code></pre>
  
  <p>i got this error : <a href="https://i.stack.imgur.com/ftYbz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ftYbz.png" alt="enter image description here"></a></p>
  
  <pre><code>File cannot be uploadedarray(1) {
        ["error"]=&gt;
        string(43) "&lt;p&gt;You did not select a file to upload.&lt;/p&gt;"
      }
  </code></pre>