相同的功能在本地工作,但不在服务器上工作。
这是我的控制器代码:
public function upload_video() {
$user_id = $this->session->userdata('userid');
$config['upload_path'] = './uploads/video/' . $user_id . '/';
$config['allowed_types'] = 'mp4|flv|wmv';
$config['encrypt_name'] = true;
$config['max_size'] = '60240000';
if (!file_exists($config['upload_path'])) {
mkdir($config['upload_path']);
}
$this->upload->initialize($config);
if (!$this->upload->do_upload()):
$error = array('error' => $this->upload->display_errors());
print_r($error);
else:
$data = $this->upload->data();
$filename = $data['file_name'];
echo trim($data['file_name'] = $filename);
endif;
}
答案 0 :(得分:0)
您的if (!$this->upload->do_upload()):
应为if (!$this->upload->do_upload('user_file')):
user_file
是您的文件输入字段name
属性的值。
在这种情况下,您的视图文件应包含以下输入
<input type="file" name="user_file"/>
答案 1 :(得分:0)
将服务器配置为接受大文件大小
设置upload_max_filesize
&amp; post_max_size
到更大的数字