這篇文章主要介紹了關於如何使用PHP實現多視頻同時上傳的功能 ,有著一定的參考價值,現在分享給大家,有需要的朋友可以參考一下
視頻的出現讓網站更加有生有色,對於php上傳視頻而言,我需要實現多視頻上傳,視頻播放功能,靜音功能,全屏播放,下載視頻功能等一體的需求,接下來就為大家詳細講解一下如何?多視頻同時上傳這樣一個功能。具體代碼如下:
PHP實現代碼:
public function doeditvideo(){ header("Content-type:text/html;charset=utf-8"); $id=I("id"); $data['addtime']=time(); if($_FILES["video"]["name"]!=''){ $arr1=$this->upload1(); $imgstr1=""; foreach($arr1 as $vv){ $imgstr1.=$vv['savename'].','; } $imgstr1=trim($imgstr1,','); $data['video']=$imgstr1; }else{ $data['video']=0; } $model=M('dynamic'); if($model->where("id=$id")->save($data)){ $this->success("成功",U("Dynamic/index")); }else{ $this->error("發布失敗"); } } public function upload1(){ import('ORG.Net.UploadFile'); $upload= new UploadFile(); // 執行個體化上傳類 $upload->maxSize = 9999999 ; // 設定附件上傳大小 $upload->allowExts = array("vob","ifo","mpg","mpeg","dat","mp4","3gp","mov","rm","ram","rmvb","wmv","asf","avi","asx"); $upload->savePath = './Public/Uploads/video/'; // 設定附件上傳目錄 $info= $upload->upload(); $arr = $upload->getUploadFileInfo(); return $arr; }
以上就是本文的全部內容,希望對大家的學習有所協助,更多相關內容請關注topic.alibabacloud.com!