title: Codeigniter file upload from a form without ajax/jquery/javascript
body: <p><strong>Context</strong> : I am updating user_profile data after user registration using form #updateprofileform ,
  i am able to process all other form fields using standard validations and insert/update using user_model.
  issue is with <code>resume</code> field which should accept a file as input type and upload to server and store its path on server (say <a href="http://domain/uploads/" rel="nofollow noreferrer">http://domain/uploads/</a>$filename) to a column in database.</p>
  
  <p><strong>Expectation</strong> A logged in user , able to view his details(if already in database),update details if incomplete profile.</p>
  
  <p><strong>Question</strong> : I found methods how we can upload a file to server using CI framework or how we can upload a file in this context using jquery/ajax/java-script. But i am looking for simple solution for above problem which can do the job with out dependency on technologies.</p>
  
  <p>user_profile.php (view)</p>
  
  <pre><code>&lt;table&gt;
  &lt;form class="row" name="updateprofile" action = "&lt;?php echo base_url()?&gt;user/user_profile" method="POST"&gt;
  &lt;tr&gt;
          &lt;td&gt;&lt;label for="email"&gt;Email ID&lt;/label&gt;&lt;/td&gt;&lt;td&gt;&lt;input class="form-control" name="email" placeholder="Email-ID" type="text" value="&lt;?php if (isset($email)) echo $email;?&gt;" /&gt; &lt;span style="color:red"&gt;&lt;?php  echo form_error('email'); ?&gt;&lt;/span&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;tr&gt;
          &lt;td&gt;&lt;label for="resume"&gt;Resume&lt;/label&gt;&lt;/td&gt;
          &lt;td&gt;
            &lt;input name="resume" placeholder="Upload resume" type="file" value="&lt;?php if (isset($resume)) echo $resume;?&gt;" /&gt;
            &lt;span style="color:red"&gt;&lt;?php  echo form_error('resume'); ?&gt;
            &lt;/span&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
    &lt;tr&gt;
          &lt;td&gt;&lt;/td&gt;
          &lt;td&gt;&lt;div class="col-md-6 col-lg-3"&gt; &lt;button type="submit" class="btn btn--primary type--uppercase" name="updateprofile" value="updateprofile" formaction = "&lt;?php echo base_url()?&gt;user/user_profile"&gt;Update Profile&lt;/button&gt; &lt;/div&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/form&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>user_controller</p>
  
  <pre><code>class User extends CI_Controller {
  
      public function __construct()
      {
          parent::__construct();
  $config = array(
          'upload_path' =&gt; "./uploads/",
          'allowed_types' =&gt; "doc|docx|pdf",
          'overwrite' =&gt; TRUE,
          'max_size' =&gt; "2048000", // Can be set to particular file size , here it is 2 MB(2048 Kb)
          //'max_height' =&gt; "768",
          //'max_width' =&gt; "1024"
          );
          $this-&gt;load-&gt;library('upload', $config);
      }
    public function user_profile()
      {  
        $resume = $this-&gt;input-&gt;post('resume');
    if ($this-&gt;user_model-&gt;set_user_profile($id,FALSE) )
              { if($this-&gt;do_upload($resume)){
                  $this-&gt;session-&gt;set_flashdata('msg_success','Updation Successful!');
                    echo validation_errors();}
              }
              else
              {
                  $this-&gt;session-&gt;set_flashdata('msg_error','Error! Please try again later.');
                  redirect('user/user_profile');
              }
    public function do_upload($resume){
  
      if($this-&gt;upload-&gt;do_upload($resume))
      {
      $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data($resume));
  
      $this-&gt;load-&gt;view('user_profile',$data);
      }
      else
      {
      $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors($resume));
      $this-&gt;load-&gt;view('user_profile', $error);
      }
      }
  </code></pre>
  
  <p>currently always error.... Error! Please try again later . so appreciate some pointers here to upload both file and form data together and save file location in database without ajax/jquery. </p>
  
  <p>Thanks</p>