Description:- Through this example you can easily come to know how to upload multiple images in one time by selecting the images through ctrl button.
<!-- Uploading multifiles by webtechball --> <!-- www.webtechball.wordpress.com --> <!DOCTYPE html> <head> <title>Multifile uploading by Webtechball</title> <style> img{margin:10px 0 0 10px; border:1px inset rgba(51,51,51,1);} </style> </head> <body> <center> <form action="<?php $_PHP_SELF; ?>" method="post" enctype="multipart/form-data"> <input type="file" name="multiImgs[]" multiple/> <input type="submit" name="upload" value="Upload"/> </form> <?php if(isset($_REQUEST['upload'])) { //Inserting the name of the files into the loop, so that it will upload each and every file for($a=0; $a < count($_FILES['multiImgs']['name']); $a++) { move_uploaded_file($_FILES['multiImgs']['tmp_name'][$a],"upload/".$_FILES['multiImgs']['name'][$a]); echo "<img src='upload/".$_FILES['multiImgs']['name'][$a]."' width=100px height=100px/>" //Printing each and every files with loop } } ?> </center> </body> </html>
*Note :- Copy the code and paste in your text editor and save it in your htdocs and
don’t forget to create a new folder and rename it as “upload”. This will be your folder where your uploaded files will going to be save.
Advertisements