codeigniter教程之上傳視頻并使用ffmpeg轉flv示例
$file = 'video_file';
$config['upload_path'] = './video_folder/';
$config['allowed_types'] = 'mov|mpeg|mp3|avi';
$config['max_size'] = '50000';
$config['max_width'] = '';
$config['max_height'] = '';
$this->upload->initialize($config);
$this->load->library('upload', $config);
if(!$this->upload->do_upload($file))
{
// If there is any error
$err_msgs .= 'Error in Uploading video '.$this->upload->display_errors().'<br />';
}
else
{
$data=array('upload_data' => $this->upload->data());
$video_path = $data['upload_data']['file_name'];
$directory_path = $data['upload_data']['file_path'];
$directory_path_full = $data['upload_data']['full_path'];
$file_name = $data['upload_data']['raw_name'];
// ffmpeg command to convert video
exec("ffmpeg -i ".$directory_path_full." ".$directory_path.$file_name.".flv");
// $file_name is same file name that is being uploaded but you can give your custom video name after converting So use something like myfile.flv.
/// In the end update video name in DB
$array = array(
'video' => $file_name.'.'.'flv',
);
$this->db->set($array);
$this->db->where('id',$id); // Table where you put video name
$query = $this->db->update('user_videos');
}
- CI框架文件上傳類及圖像處理類用法分析
- SWFUpload與CI不能正確上傳識別文件MIME類型解決方法分享
- 2個Codeigniter文件批量上傳控制器寫法例子
- Codeigniter實現(xiàn)多文件上傳并創(chuàng)建多個縮略圖
- codeigniter教程之多文件上傳使用示例
- php基于CodeIgniter實現(xiàn)圖片上傳、剪切功能
- codeigniter上傳圖片不能正確識別圖片類型問題解決方法
- Codeigniter上傳圖片出現(xiàn)“You did not select a file to upload”錯誤解決辦法
- 使用CodeIgniter的類庫做圖片上傳
- CodeIgniter上傳圖片成功的全部過程分享
- CI框架實現(xiàn)優(yōu)化文件上傳及多文件上傳的方法
相關文章
PHP中的靜態(tài)變量及static靜態(tài)變量使用詳解
這篇文章主要 紹了PHP中的靜態(tài)變量及static靜態(tài)變量使用詳解的相關資料,需要的朋友可以參考下2015-11-11YII Framework學習之request與response用法(基于CHttpRequest響應)
這篇文章主要介紹了YII Framework學習之request與response用法,詳細介紹了CHttpRequest響應request與response的使用技巧,需要的朋友可以參考下2016-03-03淺析PHP關鍵詞替換的類(避免重復替換,保留與還原原始鏈接)
一個關鍵詞替換的類,這個類主要用于關鍵詞過濾,或者是關鍵詞查找替換方面,關鍵詞替換,其實就是一個str_replace()的過程,感興趣的朋友跟著小編一起看看吧2015-09-09老生常談php中傳統(tǒng)驗證與thinkphp框架(必看篇)
下面小編就為大家?guī)硪黄仙U刾hp中傳統(tǒng)驗證與thinkphp框架(必看篇)。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2017-06-06動態(tài)表單驗證的操作方法和TP框架里面的ajax表單驗證
這篇文章主要介紹了動態(tài)表單驗證的操作方法和TP框架里面的ajax表單驗證問題,需要的朋友可以參考下2017-07-07PHP實現(xiàn)AJAX動態(tài)網(wǎng)頁及相關函數(shù)詳解
ajax其實是利用javascript向服務器請求數(shù)據(jù),然后局部修改頁面,下面這篇文章主要給大家介紹了關于PHP實現(xiàn)AJAX動態(tài)網(wǎng)頁及相關函數(shù)的相關資料,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下2022-08-08