Posted inTechnology / Ajax / JavaScript / jQuery / Laravel / Mysql / Mysqli / php / Programming

Upload Multiple Images With Image Preview Using jQuery,Ajax And PHP

Upload Multiple Images With Image Preview Using jQuery,Ajax And PHP

In this Post We Will Explain About is Upload Multiple Images With Image Preview Using jQuery,Ajax And PHP With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to How to Upload multiple images jQuery Ajax using PHP Example

In this post we will show you Best way to implement multiple image upload with preview and delete jquery, hear for Upload Multiple Images using jQuery, PHP & MySQL with Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

How to Upload multiple images jQuery Ajax using PHP

In this Example,First of all Add or Inluce External Libs Like as a(jQuery, css etc..), and then create a simple index.php or index.html page.After that crate a simple javascript file like as a index.js or main.js, It is also add your web-application First Header Part to some priorty set.After that Include your relavant CSS Class.

How to Upload multiple images jQuery Ajax using PHP

index.php












Upload

upload.php

simple File contains post upload all the files process as well as move all files in uploads Folder.

 Error: ".$_FILES["liveuploadFile"]["error"];

	       	 	 $results[$fileName]= $output_dir.$NewLiveImgName;
    	}
    	else
    	{
            $fileCount = count($_FILES["liveuploadFile"]['name']);
    		for($i=0; $i < $fileCount; $i++)
    		{
                $get_randomNo   = time();

                $LiveImgName      = str_replace(' ','-',strtolower($_FILES['liveuploadFile']['name'][$i]));
                $ImageType      = $_FILES['liveuploadFile']['type'][$i]; //"image/png", image/jpeg etc.

                $LiveImgExt = substr($LiveImgName, strrpos($LiveImgName, '.'));
                $LiveImgExt       = str_replace('.','',$LiveImgExt);
                $LiveImgName      = preg_replace("/\.[^.\s]{3,4}$/", "", $LiveImgName);
                $NewLiveImgName = $LiveImgName.'-'.$get_randomNo.'.'.$LiveImgExt;

                $results[$NewLiveImgName]= $output_dir.$NewLiveImgName;
    		    move_uploaded_file($_FILES["liveuploadFile"]["tmp_name"][$i],$output_dir.$NewLiveImgName );
    		}
    	}
    }
    echo json_encode($results);

}

?>

First of all check Folder and get some error and then check if create single file coming then simple process separate if all the multiple files handle in php loop.

$get_randomNo   = time();

$LiveImgName      = str_replace(' ','-',strtolower($_FILES['liveuploadFile']['name'][$i]));
$ImageType      = $_FILES['liveuploadFile']['type'][$i]; //"image/png", image/jpeg etc.

$LiveImgExt       = substr($LiveImgName, strrpos($LiveImgName, '.'));
$LiveImgExt       = str_replace('.','',$LiveImgExt);
$LiveImgName      = preg_replace("/\.[^.\s]{3,4}$/", "", $LiveImgName);
$NewLiveImgName   = $LiveImgName.'-'.$get_randomNo.'.'.$LiveImgExt;

Add simple using PHP UNIX time stamp with create image name to generated unique name.

You are Most welcome in my youtube Channel Please subscribe my channel. and give me FeedBack.
More Details……
Angularjs Example

Example

I hope you have Got What is How to Upload multiple images jQuery Ajax using PHP And how it works.I would Like to have FeedBack From My Blog(Pakainfo.com) readers.Your Valuable FeedBack,Any Question,or any Comments about This Article(Pakainfo.com) Are Most Always Welcome.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

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

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype