|
我写了一个上传视频的方法,但是视频上传不成功,不知道原因出现在了哪儿,请协助检查,谢谢。
PHP复制代码
//$id是本条文章的id号
public function addmove ($id){
$uid = $this->session->userdata('id');
$a=(int )($id/50);
$up_file_path=FILEPATH .'movies/'.$a;
if(is_dir($up_file_path)){
$up_file_path=$up_file_path;
}
else {
mkdir($up_file_path,0777);
}
$config['upload_path'] = $up_file_path;
$config['allowed_types'] = 'mp4|avi';
$config['max_size'] = '1000000';
$this->load->library('upload', $config);
$this->upload->do_upload("fileurl");
if(!$this->upload->do_upload('fileurl'))
{
$error = array('error' => $this->upload->display_errors());
}
$data = $this->upload->data();
$strlen=strlen(FILEPATH );
$movepath=substr($data['full_path'],$strlen);
$data1 = array(
'fileurl' => '/media/'.$movepath,
'file_name' => $data['raw_name']
);
$this->db->where('id', $id);
$this->db->update('content', $data1);
}
复制代码
|
|