public function upload(){
if(!empty($_POST['sub3']))
{
import('ORG.Net.UploadFile');
$upload = new UploadFile();// 实例化上传类
$upload->allowExts = array('jpg', 'gif', 'png', 'jpeg','flv','mp4');// 设置附件上传类型
$upload->savePath = './apps/video/Player/video/';// 设置附件上传目录
if(!$upload->upload()) {// 上传错误提示错误信息
$this->error($upload->getErrorMsg());
}else{// 上传成功 获取上传文件信息
$info = $upload->getUploadFileInfo();
}
// 保存表单数据 包括附件数据
$VideoInfo = M("VideoInfo"); // 实例化VideoInfo对象
$data['v_title'] = $_POST['name'];
//$data['v_title']=$info[0]['name'];
$data['v_language'] = $_POST['language'];
$data['v_duration']= time(); $data['v_path']='http://localhost/Thinksns/apps/video/Player/video/'.$info[0]['savename'];
$data['t_name']=$_POST['strType'];
$data['v_description'] = $_POST['description'];
$data['v_keywords'] =$_POST['keyword'];
$uid= $GLOBALS['ts']['mid'];
$data['uid']=$uid;
$data['v_size']=$info[0]['size'];
$VideoInfo->add($data);
/*echo $VideoInfo->getLastSql();
dump($data);*/
$this->success('数据保存成功');
}
} 最佳答案