thinkphp 怎么上传视频,求代码急
1个回答
展开全部
public function video_process(){ //上传 视频
$folder=$_POST['folder'];
//echo $folder;
$url=$_POST['url'];
//echo $url;
$file_name=$_POST['file_name'];
$type=2;
$pathinfo=pathinfo($_FILES["file"]["name"]);
$_FILES["file"]["name"]=time().".".$pathinfo['extension'];
//echo $_FILES["file"]["name"];
$name = iconv("UTF-8", "gb2312", $_SERVER['DOCUMENT_ROOT'].$url.$_FILES["file"]["name"]);
move_uploaded_file($_FILES["file"]["tmp_name"], $name);
$m=M('Upload');
$m->type=$type;
$m->file_name=$file_name.".".$pathinfo['extension'];
$m->folder=$folder;
$m->file_adress=$_FILES["file"]["name"];
$m->add();
if($folder==1){
$this->redirect('Index/education');
}elseif ($folder==2) {
$this->redirect('Index/train');
}elseif ($folder==3) {
$this->redirect('Index/system');
}elseif ($folder==4) {
$this->redirect('Index/facility');
}elseif ($folder==5) {
$this->redirect('Index/motto');
}
}
希望能够帮到你!
$folder=$_POST['folder'];
//echo $folder;
$url=$_POST['url'];
//echo $url;
$file_name=$_POST['file_name'];
$type=2;
$pathinfo=pathinfo($_FILES["file"]["name"]);
$_FILES["file"]["name"]=time().".".$pathinfo['extension'];
//echo $_FILES["file"]["name"];
$name = iconv("UTF-8", "gb2312", $_SERVER['DOCUMENT_ROOT'].$url.$_FILES["file"]["name"]);
move_uploaded_file($_FILES["file"]["tmp_name"], $name);
$m=M('Upload');
$m->type=$type;
$m->file_name=$file_name.".".$pathinfo['extension'];
$m->folder=$folder;
$m->file_adress=$_FILES["file"]["name"];
$m->add();
if($folder==1){
$this->redirect('Index/education');
}elseif ($folder==2) {
$this->redirect('Index/train');
}elseif ($folder==3) {
$this->redirect('Index/system');
}elseif ($folder==4) {
$this->redirect('Index/facility');
}elseif ($folder==5) {
$this->redirect('Index/motto');
}
}
希望能够帮到你!
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询