【发布时间】:2010-05-18 01:26:58
【问题描述】:
我正在尝试使用 codeigniters 上传类一次上传两个文件(两个文件字段)。尽管提供了字段名称 codeigniter 在第二个字段上产生错误。
这是对 codeigniter、php 或 html 的限制,还是我只是错误地使用了该类?
$this->upload->do_upload('video_file')
$this->upload->do_upload('image_file')
在图像字段上产生这个:
The filetype you are attempting to upload is not allowed.
这是我的两个函数
function upload_image() {
$thumb_size = 94;
$config['upload_path'] = './assets/uploads/images/';
$config['allowed_types'] = 'jpg|png|gif';
$config['max_size'] = '2048';
$config['file_name'] = 'video_' . rand(999999, 999999999);
$this->load->library('upload', $config);
if (!$this->upload->do_upload('image_file')) {
$error = array('error' => $this->upload->display_errors());
return $error;
} else {
function upload_video() {
$config['upload_path'] = './assets/uploads/videos/';
$config['allowed_types'] = 'flv';
$config['max_size'] = '0';
$config['file_name'] = 'video_' . rand(999999, 999999999);
$this->load->library('upload', $config);
if (!$this->upload->do_upload('video_file')) {
$error = array('error' => $this->upload->display_errors());
return $error;
} else {
【问题讨论】:
标签: php codeigniter