php - Codeigniter - get the uploaded file name -


how can save uploaded file's name in variable (i'm new ci)?

i using code testing:

i appreciate on guys.

this code using (and typing on , on again because of restrictions of stackoverflow):

<?php  class gallery_model extends ci_model {      var $gallery_path;     var $videos_path;     var $thumbnail;     var $video_name;      function gallery_model() {          parent::__construct();          $this->gallery_path = realpath(apppath . '../images');         $this->videos_path = realpath(apppath . '../videos');         $this->videos_path_tnumb = realpath(apppath . '../videos/thumb');          $this->thumbnail = 'c://xampp//htdocs//upload//videos//thumb';         $this->video_name = 'c://xampp//htdocs//upload//videos//79825_00_01_sc03_intro.mov';     }      function do_upload() {          $config = array( //            'allowed_types' => 'jpg|jpeg|png|gif', //            'upload_path' => $this->gallery_path, //            'max_size' => 10000              'allowed_types' => 'avi|mp4|flw|mov',             'upload_path' => $this->videos_path         );          $this->load->library('upload', $config);         $field_name = "some_field_name";         if ($this->upload->do_upload()) {             $this->getthumbimage($_post['userfile']);         }     }      function getvideoinformation($videopath) {         $movie = new ffmpeg_movie($videopath, false);          $this->videoduration = $movie->getduration();         $this->framecount = $movie->getframecount();         $this->framerate = $movie->getframerate();         $this->videotitle = $movie->gettitle();         $this->author = $movie->getauthor();         $this->copyright = $movie->getcopyright();         $this->frameheight = $movie->getframeheight();         $this->framewidth = $movie->getframewidth();         $this->pixelformat = $movie->getpixelformat();         $this->bitrate = $movie->getvideobitrate();         $this->videocodec = $movie->getvideocodec();         $this->audiocodec = $movie->getaudiocodec();         $this->hasaudio = $movie->hasaudio();         $this->audsamplerate = $movie->getaudiosamplerate();         $this->audbitrate = $movie->getaudiobitrate();     }      function getaudioinformation($videopath) {         $movie = new ffmpeg_movie($videopath, false);          $this->audioduration = $movie->getduration();         $this->framecount = $movie->getframecount();         $this->framerate = $movie->getframerate();         $this->audiotitle = $movie->gettitle();         $this->author = $movie->getauthor();         $this->copyright = $movie->getcopyright();         $this->artist = $movie->getartist();         $this->track = $movie->gettracknumber();         $this->bitrate = $movie->getbitrate();         $this->audiochannels = $movie->getaudiochannels();         $this->audiocodec = $movie->getaudiocodec();         $this->audsamplerate = $movie->getaudiosamplerate();         $this->audbitrate = $movie->getaudiobitrate();     }      function getthumbimage($videopath) {         $movie = new ffmpeg_movie($videopath, false);         $this->videoduration = $movie->getduration();         $this->framecount = $movie->getframecount();         $this->framerate = $movie->getframerate();         $this->videotitle = $movie->gettitle();         $this->author = $movie->getauthor();         $this->copyright = $movie->getcopyright();         $this->frameheight = $movie->getframeheight();         $this->framewidth = $movie->getframewidth();          $cappos = ceil($this->framecount / 4);          if ($this->framewidth > 120) {             $cropwidth = ceil(($this->framewidth - 120) / 2);         } else {             $cropwidth = 0;         }         if ($this->frameheight > 90) {             $cropheight = ceil(($this->frameheight - 90) / 2);         } else {             $cropheight = 0;         }         if ($cropwidth % 2 != 0) {             $cropwidth = $cropwidth - 1;         }         if ($cropheight % 2 != 0) {             $cropheight = $cropheight - 1;         }          $frameobject = $movie->getframe($cappos);           if ($frameobject) {             $imagename = "thumb_01.jpeg";             $tmbpath = "c:\\xampp\\htdocs\\upload\\videos\\thumb" . $imagename;             $frameobject->resize(120, 90, 0, 0, 0, 0);             imagejpeg($frameobject->togdimage(), $tmbpath);         } else {             $imagename = "";         }           return $imagename;     }  } 

$upload_data = $this->upload->data(); //returns array of containing of data related file uploaded. $file_name = $upload_data['file_name']; 

read more here v2.x , here v3.x.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

javascript - Clean way to programmatically use CSS transitions from JS? -

android - send complex objects as post php java -