PHP: How to batch upload images _ PHP Tutorial

Source: Internet
Author: User
PHP implements batch upload of images. You can use the following code to learn more about how PHP uploads images in batches. We are learning the code for batch uploading images in PHP: htmlheadtitleuploadpictur. you can use the following code to learn more about the specific method of batch uploading images in PHP. We are learningPHP code for uploading images in batches is as follows:

 
  1. <html>
  2. <head><title>upload picture more once title> head>
  3. <body>
  4. <form action="" method="post" enctype="multipart/form-data">
  5. <p>Pictures:<br />
  6. <input type="file" name="pictures[]" /><br />
  7. <input type="file" name="pictures[]" /><br />
  8. <input type="file" name="pictures[]" /><br />
  9. <input type="submit" name="upload" value="Send" />
  10. p>
  11. form>
  12. body>
  13. html>
  14. php
  15. if($_POST['upload']=='Send'){
  16. $dest_folder = "picture/";
  17. if(!file_exists($dest_folder)){
  18. mkdir($dest_folder);
  19. }
  20. foreach ($_FILES["pictures"]["error"] as $key => $error) {
  21. if ($error == UPLOAD_ERR_OK) {
  22. $tmp_name = $_FILES["pictures"]["tmp_name"][$key];
  23. $name = $_FILES["pictures"]["name"][$key];
  24. $uploadfile = $dest_folder.$name;
  25. move_uploaded_file($tmp_name, $uploadfile);
  26. }
  27. }
  28. }
  29. ?>

The above code is all PHP programming for uploading images in batches, and I hope to help anyone who needs it.


Bytes. The code for batch uploading images in PHP is as follows: html head title uploadpictur...

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.