Php Codeigniter视频上传不工作
我用下面的代码做视频上传Php Codeigniter视频上传不工作,php,codeigniter,video,Php,Codeigniter,Video,我用下面的代码做视频上传 <?php class upload_videos extends Admin_Controller { function __construct() { parent::__construct(); $this->load->helper('form'); } function index () { $this->load->view('admin/upload_
<?php
class upload_videos extends Admin_Controller {
function __construct() {
parent::__construct();
$this->load->helper('form');
}
function index () {
$this->load->view('admin/upload_form', array('error'=> ''));
}
function do_upload() {
$config['upload_path'] = './uploads';
$config['allowed_types'] = 'mov|mpeg|mp3|avi';
$config['max_size']= '';
$config['overwrite'] = FALSE;
$config['remove_spaces'] = TRUE;
$config['encrypt_name'] = TRUE;
$this->load->library('upload', $config);
if(!$this->upload->do_upload()) {
$error = array('error'=>$this->upload->display_errors() . ' hi');
$this->load->view('admin/upload_form', $error);
} else {
echo 'asasas';
$data = array('upload_data'=>$this->upload->data());
$this->load->view('admin/upload_success', $data);
}
}
}
将mp4
格式添加到允许的类型
,如下所示:
$config['allowed_types'] = 'mov|mpeg|mp3|avi|mp4';
并在config/mimes.php
中添加mp4的mime类型(如果尚未存在),如下所示:
'mp4' => array('video/mp4', 'application/octet-stream')
我也遇到同样的问题。但现在它对我来说很有效
实际上,您必须更改PHPINI文件中的两个参数
post_max_size = 100M
upload_max_filesize = 100M
但您可能还需要更改apache滥用保护参数(100M)
另一方面,PHP对每个脚本也有30秒的时间限制,因此您的脚本将在运行30秒时失效
您可能还希望增加时间,以确保您的脚本不会在上载、复制等过程中消亡
set_time_limit(600); // 10 minutos execution
从中找到此答案谢谢您的回答:)尝试此操作。还是没有运气。还是有问题。感谢您的回答:)请确保文件夹存在并且权限设置为777
。
set_time_limit(600); // 10 minutos execution