新手求解:用thinkphp3.2.2怎样写上传mv视频类控制器?谢谢
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');
}
}
希望能够帮到你!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询