PHP multi-File Upload function Implementation principle and code _php tutorial

Source: Internet
Author: User
Today, a little research on the multi-image upload function, the following code to organize out, to facilitate their own use and for everyone to communicate
1, upload.html page, that is, the first input type=file file:
Copy CodeThe code is as follows:


<title></title>






2, do_upload.php page, that is, processing multi-File upload page:
Copy CodeThe code is as follows:
Global Array $_files
$_files[' UserFile ' [' tmp_name '] files are temporarily stored in the Web server location
$_files[' UserFile ' [' name '] The file name in the user system
$_files[the byte size of the ' userfile ' [' Size '] File
MIME type of $_files[' userfile ' [' type '] file, text/plain,image/gif
$_files[' userfile ' [' ERROR '] error code associated with file upload
?>
Using a For loop to get the passed data is a three-dimensional data
for ($i =0; $i
{
$upfile = $new _folder. " /". $_files[' userfile ' [' name '] [$i];//Here you can modify the
if (move_uploaded_file ($_files[' userfile '] [' tmp_name '] in accordance with your own needs [$i ], $upfile) {
echo "). ( $i + 1). " Image upload succeeded
";
}
else{
echo "First". ( $i + 1). " Image cannot be uploaded
";
}
}
?>

http://www.bkjia.com/phpjc/326834 . html www.bkjia.com true http://www.bkjia.com/phpjc/326834.html techarticle Today, a little research on multi-image upload function, the following code to sort out , convenient for their own use and for everyone to Exchange 1, upload.html page, that is, the first input type=f ...

  • 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.