title: Uploading video files in the mysql database
body: <p>This code can upload video files but only to my specific folder. How can I upload the video files into my database and retrieve it for viewing/streaming. Could you help me please? I have read something about just not uploading it to the database but uploading it to the server? What does that means?</p>
  
  <p>This is my view:</p>
  
  <pre><code>           &lt;body&gt;
      &lt;div id="container"&gt;
  
          &lt;h1&gt;Welcome&lt;/h1&gt;
          &lt;div id="body"&gt;
  
  
             &lt;div id="div2"&gt;
            &lt;div id="upload"&gt;
          &lt;form class="cssform" name="property" id="property" method="POST" action="&lt;?php echo    base_url()?&gt;main/add_video"  enctype="multipart/form-data" &gt;
         &lt;table&gt;
        &lt;tr&gt;
  
          &lt;td&gt;&lt;input type="file" id="video" name="video" &gt;&lt;/td&gt;
         &lt;/tr&gt;
        &lt;tr&gt;
             &lt;td&gt; &lt;input type="submit" id="button" name="submit" value="Submit" /&gt;&lt;/td&gt;
          &lt;/tr&gt;
       &lt;/table&gt;
        &lt;/form&gt;
         &lt;/div&gt;
  
  
              &lt;a href='&lt;?php echo base_url()."main/logout" ?&gt;'&gt;Logout&lt;/a&gt;
          &lt;/div&gt;
          &lt;div id ="searchBox"&gt;
  
  &lt;/div&gt;
  &lt;/div&gt;
          &lt;p class="footer"&gt;Page rendered in &lt;strong&gt;{elapsed_time}&lt;/strong&gt; seconds&lt;/p&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>This is my controller:</p>
  
  <pre><code>       public function add_video(){
  
      if (isset($_FILES['video']['name']) &amp;&amp; $_FILES['video']['name'] != '') {
          unset($config);
          $date = date("ymd");
          $configVideo['upload_path'] = './videos';
          $configVideo['max_size'] = '10240';
          $configVideo['allowed_types'] = 'avi|flv|wmv|mp3';
          $configVideo['overwrite'] = FALSE;
          $configVideo['remove_spaces'] = TRUE;
          $video_name = $date.$_FILES['video']['name'];
          $configVideo['file_name'] = $video_name;
  
          $this-&gt;load-&gt;library('upload', $configVideo);
          $this-&gt;upload-&gt;initialize($configVideo);
          if (!$this-&gt;upload-&gt;do_upload('video')) {
              echo $this-&gt;upload-&gt;display_errors();
          } else {
              $videoDetails = $this-&gt;upload-&gt;data();
              echo "Successfully Uploaded";
                 }
             }
        }
  </code></pre>