PHP implementation of video file upload complete example, _php tutorial

Source: Internet
Author: User
Tags php file upload

PHP implementation of video file upload complete instance,


This paper realizes the function of uploading video files in the form of a complete instance. Although it is a relatively basic application, it still has a certain reference value. Share it for everyone's reference. Here's how:

First of all, for the PHP video also belongs to the file, we use this truth, can be uploaded with ordinary files similar to the implementation of PHP video upload files. The difference is that the video file is generally large, the upload time is long, and the PHP configuration file is also limited to the size of the upload file.
If you need to better use PHP for file upload, it is recommended to use FTP upload method.

First, the PHP processing code is as follows:

<?php//setting allows up to 10 files to be uploaded simultaneously define (' Muilti_file_upload ', ' 10 ');//Set file size not exceeding 5MBdefine (' max_size_file_upload ', ' 500000 ');//Set the storage directory of the uploaded file define (' File_upload_dir ', '/fileuploads ');//allow upload of file extension $array_extention_interdite = Array ('. flv ', '. wmv ', '. rmvb ', '. php ', '. PhP3 ', '. PhP4 ', '. exe ', '. msi ', '. htaccess ', '. gz ');//Public function functions for displaying information func_me Ssage ($message = ", $ok =") {echo ')
 
 
  
  '; if ($ok = = true) echo '
  
  ' ; else Echo ' 
   '; Echo ' 
  
'. $message. '
'. $message. '
'; }//processing form Submission $action = (Isset ($_post[' action '))? $_post[' action ']: '; $file = (isset ($_post[' file "))? $_post[' file ': '; if ($file! = ') $file = $file. ' /'; $message _true = '; $message _false = '; switch ($action) {case ' upload ': chmod (file_upload_dir,0777); for ($NB = 1; $nb <= muilti_file_upload; $NB + +) {if ($_files[' File_ '. $nb [' size '] >=) {if ($_files[' fil E_ '. $nb [' size '] <= max_size_file_upload) {if (!in_array ereg_replace (' ^[[:alnum:]] ([-_.]? [[: Alnum:]]) *. ', '. ', $_files[' file_ '. $nb [' name ']), $array _extention_interdite) {if ($_post[' file_name_ '. $nb]! = ") $file _name_final = $_post[' file_name_ '. $nb]. $extension; else $file _name_final = $_files[' File_ '. $nb [' name ']; Modify the file name $file _name_final = STRTR ($file _name_final, ' aaaaaa ', ' aaaaaaceeeeiiiiooooouuuuyaaaaaaceeeeiiiioooooouuuu yy '); $file _name_final = Preg_replace ('/([^.a-z0-1]+)/I ', ' _ ', $file _name_final); $_files[' File_ '. $nb [' name '] = $file _name_final; Start uploading Move_uploaded_file ($_files[' file_ '. $nb [' Tmp_name '], File_upload_dir. $file. $file _name_final); $message _true. = ' File upload succeeded: '. $_files[' File_ '. $nb [' name ']. '
'; }else $message _false. = ' File upload failed: '. $_files[' File_ '. $nb [' name ']. '
'; }else $message _false. = ' file maximum size cannot exceed '. max_size_file_upload/1000. ' KB: ' '. $_files[' File_ '. $nb [' Tmp_name ']. ' "
'; }}//end for the break;}? >

Second, the HTML code is as follows:

 
  PHP File Upload. border{Background-color: #000000}.box{background-color: #f8f8f9;}. text{  color: #000000; font-family: "Song body"; font-size:12px; font-weight:bold}input, select{font-size:12px;} body{  margin:0;} 
 
     

I hope this article is helpful to everyone's PHP programming.




http://www.bkjia.com/PHPjc/871101.html www.bkjia.com true http://www.bkjia.com/PHPjc/871101.html techarticle PHP Implementation of video file upload a complete example, this article in a complete instance of the form of video file upload to achieve the function. Although it is a relatively basic application, it still has a certain reference value. Points ...

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.