图像上传成功,但视频未上传,encrypt_name在视频文件名处不起作用请帮助解决此问题。
这是我的控制器:
$image = $_FILES['imagearchiev']['tmp_name'];
$video = $_FILES['videoarchiev']['tmp_name'];
if ($image !== NULL && $video !== NULL) {
if ($image) {
$config['upload_path'] = realpath('assets/image/icon/');
$config['allowed_types'] = 'gif|jpg|png|jpeg';
$config['max_size'] = 2000;
$config['encrypt_name'] = true;
$this->load->library('upload', $config);
$this->upload->do_upload('imagearchiev');
$data_upload = $this->upload->data();
$imagearchiev = $data_upload['file_name'];
}
if ($video) {
$config2['upload_path'] = realpath('assets/image/icon/');
$config2['allowed_types'] = 'mp4|MP4';
$config2['max_size'] = 20000000;
$config2['encrypt_name'] = true;
$this->load->library('upload', $config2);
$this->upload->do_upload('videoarchiev');
$data_upload2 = $this->upload->data();
$videoarchiev = $data_upload2['file_name'];
}
$titlearchiev = $this->input->post('titlearchiev');
$textarchiev = $this->input->post('summernote');
redirect('admin/addarchievement');
}
1条答案
按热度按时间n3schb8v1#
根据所需的文件夹结构修改路径