The ci framework and the question of video upload. I am new to the ci framework. many of them are unclear. Recently, I encountered some difficulties in developing a file upload function.
// $ Id is the id of this article, meaning that each folder can only store 50 videos public function addmove ($ id) {$ uid = $ this-> session-> userdata ('id'); $ a = (int) ($ id/50); $ up_file_path = FILEPATH. 'movies /'. $ a; if (is_dir ($ up_file_path) {$ up_file_path = $ up_file_path;} else {mkdir ($ up_file_path, 0777 );} $ config ['upload _ path'] = $ up_file_path; $ config ['allowed _ types '] = 'mp4 | avi '; $ config ['max _ size'] = '000000'; $ this-> load-> library ('upload', $ config); $ This-> upload-> do_upload ("fileurl"); if (! $ This-> upload-> do_upload ('fileurl') {$ error = array ('error' => $ this-> upload-> display_errors ());} $ data = $ this-> upload-> data (); $ strlen = strlen (FILEPATH); $ movepath = substr ($ data ['full _ path'], $ strlen); $ data1 = array ('fileurl' => '/media /'. $ movepath, 'File _ name' => $ data ['raw _ name']); $ this-> db-> where ('id', $ id ); $ this-> db-> update ('content', $ data1 );}
Problem:
1. there are not many files. Should the directory I have stored be correct?
2. video files in this directory can be downloaded in windows. video files cannot be downloaded in linux. the error 404 is displayed (the file cannot be found );
3. this program does not upload the video to the corresponding folder. I do not know where the problem occurs.
Thank you for solving the problem.
Reply to discussion (solution)
2. video files in this directory can be downloaded in windows. video files cannot be downloaded in linux. the error 404 is displayed (the file cannot be found );
The stored directory is/media/movies/1/I love you .mp4
Add the mime type in config. php.