Multiple Images Uploads Step by Step
1 | < input type = "file" name = "image[]" id = "form-field-2" placeholder = "Select News Image For Uploading" class = "col-xs-10 col-sm-5" required multiple = "multiple" /> |
<input type="file" name="image[]" id="form-field-2" placeholder="Select News Image For Uploading" class="col-xs-10 col-sm-5" required multiple="multiple" />
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | <?php include "connection.php" ; // include your database connection file if (isset( $_POST [ 'submit' ])) { extract( $_POST ); $i =0; $total = count ( $_FILES [ 'image' ][ 'name' ]); for ( $i =0; $i < $total ; $i ++) { $tmpFilePath = $_FILES [ 'image' ][ 'tmp_name' ][ $i ]; if ( $tmpFilePath != "" ){ $img =md5(time()); $newFilePath = "" . $img . $_FILES [ 'image' ][ 'name' ][ $i ]; if (move_uploaded_file( $tmpFilePath , "../event/" . $newFilePath )) { $query =mysqli_query( $con , "insert into event_photo(ep_e_id,ep_photo) values ('$title','$newFilePath')" ) or die (mysqli_error( $con )); if ( $query ==1) { echo '<script type="text/javascript">' ; echo 'alert("Event Image Uploaded Successfully...");' ; echo 'window.location.href = "add_event_photo.php";' ; echo '</script>' ; } else { echo "" .mysqli_error( $con ); } } elseif (isset( $_POST [ 'cancel' ])) { echo '<script type="text/javascript">' ; echo 'window.location.href = "add_event_photo.php";' ; echo '</script>' ; } } } } |
<?php include "connection.php"; // include your database connection file if(isset($_POST['submit'])) { extract($_POST); $i=0; $total = count($_FILES['image']['name']); for($i=0; $i<$total; $i++) { $tmpFilePath = $_FILES['image']['tmp_name'][$i]; if ($tmpFilePath != ""){ $img=md5(time()); $newFilePath ="".$img.$_FILES['image']['name'][$i]; if(move_uploaded_file($tmpFilePath, "../event/".$newFilePath)) { $query=mysqli_query($con,"insert into event_photo(ep_e_id,ep_photo) values ('$title','$newFilePath')") or die(mysqli_error($con)); if($query==1) { echo '<script type="text/javascript">'; echo 'alert("Event Image Uploaded Successfully...");'; echo 'window.location.href = "add_event_photo.php";'; echo '</script>'; } else { echo"".mysqli_error($con); } } elseif(isset($_POST['cancel'])) { echo '<script type="text/javascript">'; echo 'window.location.href = "add_event_photo.php";'; echo '</script>'; } } } }
This comment has been removed by the author.
ReplyDeleteReally informative post.
ReplyDeleteinstitute of vedic astrology reviews
institute of vedic astrology reviews
institute of vedic astrology reviews
institute of vedic astrology reviews
institute of vedic astrology Indore reviews
institute of vedic astrology reviews
institute of vedic astrology reviews
institute of vedic astrology reviews
Shahni Digital Media provides complete digital marketing solutions to your business. e.g. ppc, social media marketing, web designing & development. Hire us to grow up your business high.
ReplyDeleteDigital Marketing Company Bhopal
Website Designing Company Bhopal
SEO Company in Bhopal
ORM Company India
Thanks For Sharing his nice Post.
ReplyDeleteWeb Developing Company In Surat
I used your code for my project. Its working nice.
ReplyDeleteCreate Dynamically Generated Text File and Download Using JavaScript