Php 如何在codeigniter中上传超过50MB的mp4视频?
我使用下面的代码,我添加了最大大小,但它只上载1或2 mb视频,如果我上载55 mb视频,需要很长时间才能处理,但结果显示为空白页:Php 如何在codeigniter中上传超过50MB的mp4视频?,php,codeigniter,video,mp4,Php,Codeigniter,Video,Mp4,我使用下面的代码,我添加了最大大小,但它只上载1或2 mb视频,如果我上载55 mb视频,需要很长时间才能处理,但结果显示为空白页: if (isset($_FILES['video']['name']) && $_FILES['video']['name'] != '') { unset($config); $date = date("ymd"); $configVideo['upload_path']
if (isset($_FILES['video']['name']) && $_FILES['video']['name'] != '') {
unset($config);
$date = date("ymd");
$configVideo['upload_path'] = './videos';
$configVideo['max_size'] = '602400000';
$configVideo['allowed_types'] = 'mp4|avi|flv|wmv|';
$configVideo['overwrite'] = FALSE;
$configVideo['remove_spaces'] = TRUE;
$video_name = $date.$_FILES['video']['name'];
$configVideo['file_name'] = $video_name;
$this->load->library('upload', $configVideo);
$this->upload->initialize($configVideo);
if (!$this->upload->do_upload('video')) {
echo $this->upload->display_errors();
} else {
$videoDetails = $this->upload->data();
$schdate = $this->input->post('scheduledate');
$schdesc = $this->input->post('scheduledes');
$user = '1';
$data = array(
'name' =>$configVideo['file_name'],
'date' => $schdate,
'description' => $schdesc,
'user_id' => $user
);
$this->db->insert('ch_schedule', $data);
echo "Successfully Uploaded";
}
}
检查php.ini中的upload_max_文件大小和post_max_大小检查php.ini中的upload_max_文件大小和post_max_大小您只需在Codeigniter中设置您的
首选项
$config['upload_path'] = './uploads/'; # This is the upload destination directory
$config['allowed_types'] = 'mp4'; #These are the allowed file types
$config['max_size'] = '100'; #This is the max size allowed
遵循Codeigniter的这一点
$config['upload_path'] = './uploads/'; # This is the upload destination directory
$config['allowed_types'] = 'mp4'; #These are the allowed file types
$config['max_size'] = '100'; #This is the max size allowed
注:
还要检查php.ini中的upload_max_filesize
和post_max_size
。如果您只是做了此更改,请不要忘记停止并启动或重新启动apache
更新:
如果您正在联机工作并且无法更改php.ini
在控制器中有以下代码
ini_set('upload_max_filesize', '200M');
ini_set('post_max_size', '200M');
ini_set('max_input_time', 3000);
ini_set('max_execution_time', 3000);
您只需在Codeigniter中设置
首选项
$config['upload_path'] = './uploads/'; # This is the upload destination directory
$config['allowed_types'] = 'mp4'; #These are the allowed file types
$config['max_size'] = '100'; #This is the max size allowed
遵循Codeigniter的这一点
$config['upload_path'] = './uploads/'; # This is the upload destination directory
$config['allowed_types'] = 'mp4'; #These are the allowed file types
$config['max_size'] = '100'; #This is the max size allowed
注:
还要检查php.ini中的upload_max_filesize
和post_max_size
。如果您只是做了此更改,请不要忘记停止并启动或重新启动apache
更新:
如果您正在联机工作并且无法更改php.ini
在控制器中有以下代码
ini_set('upload_max_filesize', '200M');
ini_set('post_max_size', '200M');
ini_set('max_input_time', 3000);
ini_set('max_execution_time', 3000);
如果您的机器是服务器 所有访问和上传大文件的人都可以这样做 如果要在php ini中更改max文件上载 下面是php.ini文件的链接
如果您的机器是服务器,请确保在修改php.ini文件后重新启动Apache 所有访问和上传大文件的人都可以这样做 如果要在php ini中更改max文件上载 下面是php.ini文件的链接
请确保在修改php.ini文件后重新启动Apache,使用传统的上载系统上载大型视频文件不是一个有效的选择。使用ftp上载大型视频文件。在cpanel上创建ftp。使用传统上载系统上载大型视频文件不是一个有效的选择。使用ftp上载大型视频文件。在cpanel上创建一个ftp。 正如您在所附的屏幕截图中看到的,只需转到php设置页面 然后将
post\u max\u size
更改为您想要的大小。
正如您在所附的屏幕截图中看到的,只需转到php设置页面
并将
post_max_size
更改为所需大小。如果您的Web服务器不允许上载如此大的文件,则当达到其定义的允许大小或脚本超时限制时,它将停止执行。查找upload_max_filesize
和post_max_size
但我无法更改服务器的php.ini文件如果您的Web服务器不允许上载如此大的文件,它将在达到其定义的允许大小或达到脚本超时限制时停止执行。查找upload\u max\u filesize
和post\u max\u size
但我无法更改服务器的php.ini文件谢谢回复,但我必须更改整个服务器的php.ini。如何在codeigniter中添加php.ini,或者如何仅更改我的站点的大小?您正在使用本地计算机或服务器?请尝试此ini集(“post_max_size”,“64M”);ini_集('upload_max_filesize','64M');但我无法更改服务器的php.ini文件。put ini_set('post_max_size','64M');ini_集('upload_max_filesize','64M');在您的文件中,谢谢您的回复,但我必须为整个服务器更改php.ini。如何在codeigniter中添加php.ini,或者如何仅更改我的站点的大小?您正在使用本地计算机或服务器?请尝试此ini集(“post_max_size”,“64M”);ini_集('upload_max_filesize','64M');但我无法更改服务器的php.ini文件。put ini_set('post_max_size','64M');ini_集('upload_max_filesize','64M');在您的文件中,最大大小不起作用,因为我想上传更多50MB的视频,我无法更改服务器的php.ini文件。如果您正在联机工作,并且无法编辑php.ini
,请执行我在回答中建议的操作(我已更新我的回答)最大大小不起作用,因为我想上传更多50MB的视频,我无法更改服务器的php.ini文件。如果您正在联机工作,并且无法编辑php.ini
,请执行我在回答中建议的操作(我已更新了我的回答),他正在尝试使用脚本执行此操作。FTP在这里不是一个选项。他正在试图用一个脚本来实现这一点。FTP在这里不是一个选项。