Home > Backend Development > PHP Tutorial > How to use PHP to upload multiple videos at the same time

How to use PHP to upload multiple videos at the same time

不言
Release: 2023-04-02 22:00:01
Original
3720 people have browsed it

This article mainly introduces how to use PHP to realize the function of uploading multiple videos at the same time. It has a certain reference value. Now I share it with you. Friends in need can refer to the

video appearance website To be more vivid, for uploading videos in PHP, I need to implement multiple video uploads, video playback functions, mute functions, full-screen playback, and video download functions. Next, I will explain in detail how to implement multiple videos at the same time. Upload such a function. The specific code is as follows:

PHP implementation code:

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;
  }
Copy after login

The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

How to use php to calculate the distance between strings

How to use php to get the image in the document Analysis

The above is the detailed content of How to use PHP to upload multiple videos at the same time. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template