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实现多文件上传并创建多个缩略图
- codeigniter教程之多文件上传使用示例
- php基于CodeIgniter实现图片上传、剪切功能
- codeigniter上传图片不能正确识别图片类型问题解决方法
- Codeigniter上传图片出现“You did not select a file to upload”错误解决办法
- 使用CodeIgniter的类库做图片上传
- CodeIgniter上传图片成功的全部过程分享
- CI框架实现优化文件上传及多文件上传的方法
相关文章
在WordPress中安装使用视频播放器插件Hana Flv Player
这篇文章主要介绍了在WordPress中安装使用播放器插件Hana Flv Player的方法,包括其简单的代码控制,需要的朋友可以参考下2016-01-01php ucwords() 函数将字符串中每个单词的首字符转换为大写(实现代码)
下面小编就为大家带来一篇php ucwords() 函数将字符串中每个单词的首字符转换为大写(实现代码)。小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧2016-05-05curl不使用文件存取cookie php使用curl获取cookie示例
这篇文章主要介绍了curl不使用文件存取cookie的示例,不使用COOKIEJAR和COOKIEFILE存取COOKIE,大家参考使用吧2014-01-01
最新评论