title: Codeigniter - get the uploaded file name
body: <p>How can I save my uploaded file's name in a variable (I'm new to CI)?</p>
  
  <p>I am using this code for testing:</p>
  
  <p>I would really appreciate your help on this guys. </p>
  
  <p>This is the code I am using (and I am typing this over and over again because of the restrictions of stackoverflow):</p>
  
  <pre><code>&lt;?php
  
  class Gallery_model extends CI_Model {
  
      var $gallery_path;
      var $videos_path;
      var $thumbnail;
      var $video_name;
  
      function Gallery_model() {
  
          parent::__construct();
  
          $this-&gt;gallery_path = realpath(APPPATH . '../images');
          $this-&gt;videos_path = realpath(APPPATH . '../videos');
          $this-&gt;videos_path_tnumb = realpath(APPPATH . '../videos/thumb');
  
          $this-&gt;thumbnail = 'C://xampp//htdocs//upload//videos//thumb';
          $this-&gt;video_name = 'C://xampp//htdocs//upload//videos//79825_00_01_SC03_intro.mov';
      }
  
      function do_upload() {
  
          $config = array(
  //            'allowed_types' =&gt; 'jpg|jpeg|png|gif',
  //            'upload_path' =&gt; $this-&gt;gallery_path,
  //            'max_size' =&gt; 10000
  
              'allowed_types' =&gt; 'avi|mp4|flw|mov',
              'upload_path' =&gt; $this-&gt;videos_path
          );
  
          $this-&gt;load-&gt;library('upload', $config);
          $field_name = "some_field_name";
          if ($this-&gt;upload-&gt;do_upload()) {
              $this-&gt;getThumbImage($_POST['userfile']);
          }
      }
  
      function getVideoInformation($videoPath) {
          $movie = new ffmpeg_movie($videoPath, false);
  
          $this-&gt;videoDuration = $movie-&gt;getDuration();
          $this-&gt;frameCount = $movie-&gt;getFrameCount();
          $this-&gt;frameRate = $movie-&gt;getFrameRate();
          $this-&gt;videoTitle = $movie-&gt;getTitle();
          $this-&gt;author = $movie-&gt;getAuthor();
          $this-&gt;copyright = $movie-&gt;getCopyright();
          $this-&gt;frameHeight = $movie-&gt;getFrameHeight();
          $this-&gt;frameWidth = $movie-&gt;getFrameWidth();
          $this-&gt;pixelFormat = $movie-&gt;getPixelFormat();
          $this-&gt;bitRate = $movie-&gt;getVideoBitRate();
          $this-&gt;videoCodec = $movie-&gt;getVideoCodec();
          $this-&gt;audioCodec = $movie-&gt;getAudioCodec();
          $this-&gt;hasAudio = $movie-&gt;hasAudio();
          $this-&gt;audSampleRate = $movie-&gt;getAudioSampleRate();
          $this-&gt;audBitRate = $movie-&gt;getAudioBitRate();
      }
  
      function getAudioInformation($videoPath) {
          $movie = new ffmpeg_movie($videoPath, false);
  
          $this-&gt;audioDuration = $movie-&gt;getDuration();
          $this-&gt;frameCount = $movie-&gt;getFrameCount();
          $this-&gt;frameRate = $movie-&gt;getFrameRate();
          $this-&gt;audioTitle = $movie-&gt;getTitle();
          $this-&gt;author = $movie-&gt;getAuthor();
          $this-&gt;copyright = $movie-&gt;getCopyright();
          $this-&gt;artist = $movie-&gt;getArtist();
          $this-&gt;track = $movie-&gt;getTrackNumber();
          $this-&gt;bitRate = $movie-&gt;getBitRate();
          $this-&gt;audioChannels = $movie-&gt;getAudioChannels();
          $this-&gt;audioCodec = $movie-&gt;getAudioCodec();
          $this-&gt;audSampleRate = $movie-&gt;getAudioSampleRate();
          $this-&gt;audBitRate = $movie-&gt;getAudioBitRate();
      }
  
      function getThumbImage($videoPath) {
          $movie = new ffmpeg_movie($videoPath, false);
          $this-&gt;videoDuration = $movie-&gt;getDuration();
          $this-&gt;frameCount = $movie-&gt;getFrameCount();
          $this-&gt;frameRate = $movie-&gt;getFrameRate();
          $this-&gt;videoTitle = $movie-&gt;getTitle();
          $this-&gt;author = $movie-&gt;getAuthor();
          $this-&gt;copyright = $movie-&gt;getCopyright();
          $this-&gt;frameHeight = $movie-&gt;getFrameHeight();
          $this-&gt;frameWidth = $movie-&gt;getFrameWidth();
  
          $capPos = ceil($this-&gt;frameCount / 4);
  
          if ($this-&gt;frameWidth &gt; 120) {
              $cropWidth = ceil(($this-&gt;frameWidth - 120) / 2);
          } else {
              $cropWidth = 0;
          }
          if ($this-&gt;frameHeight &gt; 90) {
              $cropHeight = ceil(($this-&gt;frameHeight - 90) / 2);
          } else {
              $cropHeight = 0;
          }
          if ($cropWidth % 2 != 0) {
              $cropWidth = $cropWidth - 1;
          }
          if ($cropHeight % 2 != 0) {
              $cropHeight = $cropHeight - 1;
          }
  
          $frameObject = $movie-&gt;getFrame($capPos);
  
  
          if ($frameObject) {
              $imageName = "thumb_01.jpeg";
              $tmbPath = "C:\\xampp\\htdocs\\upload\\videos\\thumb" . $imageName;
              $frameObject-&gt;resize(120, 90, 0, 0, 0, 0);
              imagejpeg($frameObject-&gt;toGDImage(), $tmbPath);
          } else {
              $imageName = "";
          }
  
  
          return $imageName;
      }
  
  }
  </code></pre>