jQuery Ajax Upload Multiple Images using PHP

Today, We want to share with you jQuery Ajax Upload Multiple Images using PHP.In this post we will show you how to insert image in database using ajax in php, hear for ajax multiple file upload form using jquery demo we will give you demo and example for implement.In this post, we will learn about multiple image upload with preview and delete jquery php with an example.

jQuery Ajax Upload Multiple Images using PHP

There are the Following The simple About jQuery Ajax Upload Multiple Images using PHP Full Information With Example and source code.

As I will cover this Post with live Working example to develop upload multiple images in php with preview, so the multiple image upload in php with database for this example is following below.

jQuery Multiple Files Upload Form

JavaScript Source Code:


HTML Source Code:


Uploaded Images Preview

 

Upload Multiple Images with PHP

upload.php

$val){
        $image_name = $_FILES['pictures']['name'][$key];
        $tmp_name   = $_FILES['pictures']['tmp_name'][$key];
        $size       = $_FILES['pictures']['size'][$key];
        $type       = $_FILES['pictures']['type'][$key];
        $error      = $_FILES['pictures']['error'][$key];
        
        // File upload path
        $fileName = basename($_FILES['pictures']['name'][$key]);
        $live_imgPath = $targetDir . $fileName;
        
        // Check whether file type is valid
        $fileType = pathinfo($live_imgPath,PATHINFO_EXTENSION);
        if(in_array($fileType, $allowTypes)){    
            // Store pictures on the server
            if(move_uploaded_file($_FILES['pictures']['tmp_name'][$key],$live_imgPath)){
                $pictures_arr[] = $live_imgPath;
            }
        }
    }
    
    // Generate powerfule simple all the Display view of the pictures
    if(!empty($pictures_arr)){ ?>
        

PHP upload the pictures as well render the preview

$val){
        //preview pictures without stored
        $picture_data_info = getpicturesize($_FILES['pictures']['tmp_name'][$key]);
        $pictures_arr[] = "data:" . $picture_data_info["mime"] . ";base64," . base64_encode(file_get_contents($_FILES['pictures']['tmp_name'][$key]));
    }
?>
Angular 6 CRUD Operations Application Tutorials

Read :

Summary

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

I hope you get an idea about jQuery Ajax Upload Multiple Images using PHP.
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