PHP Multi-File upload implementation code

Source: Internet
Author: User
Tags file upload

  This article mainly introduces PHP multiple file upload implementation code, need friends can refer to the following

index_uploads.php     Code as follows: <html> <head>     <meta charset= "Utf-8" >     & Lt;title>index_uploads</title> </head> <body>     <form action= "uploads.php" method = "POST" enctype= "Multipart/form-data" >         <input type= "file" Name= "file[]" >   & nbsp     <br>         <input type= "file" name= "file[" ">         & lt;br>         <input type= "Submit" value= "uploads" >     </form> </BODY&G T </html>     uploads.php     code as follows: <?php             Header ("cont Ent-type:text/html;charset=utf-8 ");             echo "<pre>";             Print_r ($_files);             echo "</pre>";               $count = count ($_files[' file '] [' name ']);               for ($i = 0; $i < $count; $i + +) {          & nbsp     $tmpfile = $_files[' file ' [' Tmp_name '] [$i];                 $filefix = Array_pop (Explode (".", $_files[' file '] [' name '] [$i]);                 $dstfile = "uploads/files/". Time (). _ ". Mt_rand ().". ". $filefix;                   if (Move_uploaded_file ($tmpfile, $dstfile)) {                    echo "<script>alert (' succeed! '); window.location.href= ' index_uploads.php ';</script> ';                } else {                & nbsp   echo "<script>alert (' fail! '); window.location.href= ' index_uploads.php ';</script> ';                }             {      core:<1> upload nam for input in homepage The E property is set this way.   <2> upload multiple files with a while loop.  
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.