Ajax Upload Multiple Images without form submitting

Today, We want to share with you Ajax Upload Multiple Images without form submitting.In this post we will show you PHP Ajax Multiple Image Upload with Preview Example, hear for Uploading files/image with Ajax & Jquery, without submitting a form we will give you demo and example for implement.In this post, we will learn about Ajax Image Upload using PHP and jQuery Example Without Page Refresh with Validation with an example.

Ajax Upload Multiple Images without form submitting

There are the Following The simple About Ajax Upload Multiple Images without form submitting Full Information With Example and source code.

As I will cover this Post with live Working example to develop How to upload a file in Ajax without using a form in PHP, so the some Upload Multiple Images Using PHP and jQuery for this example is following below.

Example 1: Jquery Ajax Uploading image without submitting a form


jQuery Part

$(document).on("click", "#upload", function() {
	var file_data = $("#profile").prop("files")[0];   
	var profile_form_data = new FormData();                
	profile_form_data.append("file", file_data)            
	profile_form_data.append("user_name", "jaydeep Gondaliya")                 
                url: "/members_profile_avatar",
                dataType: 'script',
                cache: false,
                contentType: false,
                processData: false,
                data: profile_form_data,                         
                type: 'post'

Example 2: Ajax Multiple Image upload using jQuery and PHP


Ajax Image upload - PHP Mysql


function fileread(file) {
var fsize = file.files[0].size;
var fileimgName = file.files[0].name;
var fileimgtype = file.files[0].type;
 var fileimgArr = ["image/png", "image/jpeg", "image/gif", "image/jpg"];
 var fileTrue = fileimgArr.indexOf(fileimgtype);
 var reader = new FileReader();
 reader.element = $(file).parent().find('imgThumbals');
 reader.onload = function(e) {
 var div = document.getElementById("imgThumbals");
 div.innerHTML = "Ajax Upload Multiple Images without form submitting";

var formData = new FormData();
 for (var i = 0; i < file.files.length; i++) {
 var fileup = file.files[i];
 if (!fileup.type.match('image.*')) {
 // Add the file to the request.
 formData.append('memberprofilename[]', fileup, fileup.name);

 reader.onerror = function(e) {
	alert("error: " + e.target.error.code);
 document.getElementById("error").innerHTML = "Incorrect file format, Please select an image file format..";

 function fileImgUpload(formData){
 var xhr = new XMLHttpRequest();
xhr.open('POST', 'upload.php', true);
xhr.onload = function () {
 if (xhr.status === 200) {
 } else {
 alert('An error occurred!');

xhr.upload.addEventListener("progress", profile_imgprogress, false);
xhr.addEventListener("load", Completed, false);
xhr.addEventListener("error", failstatus, false);
 xhr.addEventListener("abort", Abortedstatus, false);


 function profile_imgprogress(event){
 document.getElementById('profile_complete').style.display = 'none';
document.getElementById('profile_uploaded_status').style.display = 'block';

 var percent = (event.loaded / event.total) * 100;
 document.getElementById("status").value = Math.round(percent);
 $("#progressbar").progressbar({value: document.getElementById("status").value});
 document.getElementById("status").innerHTML = Math.round(percent)+"%";


 echo "
Your Profile Successfully uploaded.
"; } ?>
Angular 6 CRUD Operations Application Tutorials

Read :


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

I hope you get an idea about Ajax Upload Multiple Images without form submitting.
I would like to have feedback on my Pakainfo.com 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.

Leave a Comment