将视频存储到服务器时遇到问题。我已经更改了 mimes.php 中所有可能的类型,但问题仍然存在,这是我的代码。 控制器
public function frontsliderAdd()
{
if ($this->session->userdata('admin_logged_in') != TRUE) {
redirect(base_url() . 'admin/login');
}
$data['active'] = 'frontslider';
if (isset($_POST['addgallery'])) {
$this->form_validation->set_rules('title', 'Banner Title', 'trim|required');
$this->form_validation->set_rules('video_url', 'Video Link', 'trim|required');
if ($_FILES["video_upload"]['name'] == '') {
$this->form_validation->set_rules('image_upload', 'Image', 'required');
}
if ($this->form_validation->run() == TRUE) {
if ($_FILES["video_upload"]['name']) {
$config['upload_path'] = './public/uploads/banner_images';
$config['allowed_types'] = 'jpg|png|jpeg|gif|mp4|avi|mov';
//$this->load->library('upload', $config);
$config['max_size'] = '0';
$this->load->library('upload', $config);
if (!$this->upload->do_upload('video_upload')) {
$error_msg = $this->upload->display_errors();
} else {
$data['video'] = $this->upload->data();
}
}
模型
public function saveGallery($data)
{
$array = array(
'title' => $data['title'],
'video' => $data['video']['file_name'],
'video_url' => $data['video_url']
);
$this->db->insert('front_slider', $array);
}
查看-添加
<div class="form-group">
<label for="image_upload">Upload Video</label>
<input type="file" class="form-control" id="video_upload" name="video_upload">
<span class="help-block" style="color: red;"><?php echo form_error('video_upload') ?></span>
</div>
哑剧
'3gp' => array('video/3gp', 'video/3gpp'),
'mp4' => 'video/mp4',
它没有给出错误,但成功地将其他数据传递给服务器,除了只有视频请纠正,thanx提前
慕妹3242003
潇湘沐
相关分类