我需要验证CodeIgniter中的视频上传大小限制(在服务器端)。
我想通过数组验证:
array('field' => 'd_video',
'label' => 'Doctor Video',
'rules' => 'required|file_allowed_type[media]|upload_max_filesize[3072]')
答案 0 :(得分:0)
根据CI Document应该如下:
$config['upload_path'] = '/uploads/';
$config['allowed_types'] = 'mpeg|avi|wmv';
$config['max_size'] = '2048'; // File Size in KB
$this->load->library('upload', $config);
$this->upload->initialize($config);
if($this->upload->do_upload('d_video'))
{
// Upload Success
}
else
{
echo $this->upload->display_errors();
}