Bootstrap Modal popup multiple File Upload using AJAX – Technology

Bootstrap Modal popup multiple File Upload using AJAX – Technology

In this post we will give you information about Bootstrap Modal popup multiple File Upload using AJAX – Technology. Hear we will give you detail about Bootstrap Modal popup multiple File Upload using AJAX – TechnologyAnd how to use it also give you demo for it if it is necessary.

Today, We want to share with you Bootstrap Modal popup multiple File Upload using AJAX.In this post we will show you File upload through a modal using Ajax, hear for Modal popup Upload Multiple Images Using PHP and jQuery we will give you demo and example for implement.In this post, we will learn about How to Make Bootstrap Modal with File Upload and Preview – jQuery AJAX with an example.

Bootstrap Modal popup multiple File Upload using AJAX

There are the Following The simple About Bootstrap Modal popup multiple File Upload using AJAX Full Information With Example and source code.

Another must read:  get selected option value jquery Example

As I will cover this Post with live Working example to develop Drag & Drop File Upload Dialog with jQuery and Bootstrap, so the bootstrap modal file upload for this example is following below.

File upload through a modal using Ajax

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

<h1>Modal popup Upload Multiple Images Using PHP and jQuery</h1>
<button type="button"  data-toggle="modal" data-target="#uploadModal">Upload file</button>

<!-- Modal -->
<div id="uploadModal"  role="dialog">
  <div >

    <!-- onlinecode Modal content-->
    <div >
      <div >
        <button type="button"  data-dismiss="modal">×</button>
        <h4 >Your File upload form</h4>
      </div>
      <div >
        <!-- onlinecode Form -->
        <form method='post' action='' enctype="multipart/form-data">
          Select Images/file : <input type='file' name='file' id='file' class='onlinecode form-control' ><br>
          <input type='button' class='onlinecode btn btn-primary' value='Upload' id='flupload'>
        </form>

        <!-- Preview-->
        <div id='display_img'></div>
      </div>
	<a href="https://onlinecode.org/" target="_blank" alt="onlinecode" title="onlinecode">Free Download Example - onlinecode</a>
    </div>

  </div>
</div>

PHP(do_upload.php)

<?php

//Get a file name
$liveflname = $_FILES['file']['name'];

// Location
$file_places = 'upload/'.$liveflname;

//Get file extension using PHP
$fl_ext = pathinfo($file_places, PATHINFO_EXTENSION);
$fl_ext = strtolower($fl_ext);

// Valid image extensions
$image_ext = array("jpg","png","jpeg","gif");

$results = 0;
if(in_array($fl_ext,$image_ext)){
  // Upload file
  if(move_uploaded_file($_FILES['file']['tmp_name'],$file_places)){
    $results = $file_places;
  }
}

echo $results;

jQuery

$(document).ready(function(){
  $('#flupload').click(function(){

    var frmdata = new FormData();
    var files = $('#file')[0].files[0];
    frmdata.append('file',files);

    //jquery AJAX request
    $.ajax({
      url: 'do_upload.php',
      type: 'post',
      data: frmdata,
      contentType: false,
      processData: false,
      success: function(results){
        if(results != 0){
          // Here image display_img
          $('#display_img').append("<img src='"+results+"' width='100' height='100' style='display: inline-block;'>");
        }else{
          alert('file not uploaded');
        }
      }
    });
  });
});
Angular 6 CRUD Operations Application Tutorials

Read :

Another must read:  vue Select Box binding Example

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Bootstrap Modal popup multiple File Upload using AJAX.
I would like to have feedback on my onlinecode blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Hope this code and post will helped you for implement Bootstrap Modal popup multiple File Upload using AJAX – Technology. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

50  +    =  57

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US