在我的控制器中,我正在尝试添加音频和视频,我更改了我的php.ini文件并扩展了max_file_size,post_size等。
当我上传 25M 的视频时,它已成功上传
但是当我尝试上传 4MB 的音频文件时,它就失败了。
然后我再次尝试上传 433KB 的音频文件,成功上传。
这是我的代码,我无法找到它无效的原因
if(!empty($_FILES['audio_upload']['name'])){
$config['upload_path'] = 'uploads/';
$config['allowed_types'] = 'mp3|wmv|mp4';
$config['max_size'] = '0';
$config['file_name'] = $this->input->post('sub_category_name');
//Load upload library and initialize configuration
$this->load->library('upload',$config);
$this->upload->initialize($config);
if($this->upload->do_upload('audio_upload')){
$uploadData = $this->upload->data();
$audio_upload = $uploadData['file_name'];
}
else{
$audio_upload = '';
}
}
if( !empty($audio_upload)){
$media_link = 'uploads/'.$audio_upload;
}
else{
$media_link = $this->input->post('media_link');
}
//**************************************END
//**************************************Video Upload
if(!empty($_FILES['video_upload']['name'])){
$config['upload_path'] = 'uploads/';
$config['allowed_types'] = 'mp3|wmv|mp4';
$config['max_size'] = '0';
$config['file_name'] = $this->input->post('sub_category_name');
//Load upload library and initialize configuration
$this->load->library('upload',$config);
$this->upload->initialize($config);
if($this->upload->do_upload('video_upload')){
$uploadData = $this->upload->data();
$video_upload = $uploadData['file_name'];
}
else{
$video_upload = '';
}
}
if( !empty($video_upload)){
$video_link = 'uploads/'.$video_upload;
}
else{
$video_link = $this->input->post('media_link');
}