Image Upload in PHP with jQuery Ajax

Image file upload in PHP using jQuery ajax; In this tutorial, you will learn how to upload image file using ajax and jQuery without refresh the whole web page. As well as learn how to store images in the PHP project folder and Mysql database.

How to Image Upload in PHP with jQuery Ajax

Follow following the below steps and upload image using ajax and jquery without refreshing the whole web page in PHP with MySQL:

Step 1: Create index.php

First of all, create an index.php file and update the below HTML code into your index.php file.



Upload image using php and ajax whithout refreshing page 


   

	
	

This HTML code shows the image upload form, so using this form you can upload the images on the DB table and project folder.

Step 2: Create connection.php

In this step, create a file name db.php and update the below code into your file.

This code is used to create a MySQL database connection in your PHP project.

Step 3: Create upload-image.php

create a new file name upload-image.php file and update the below code into your upload.php file.

";
	}else{
		echo "image uploading failed";
	}


}
?>

This PHP code uploads the image in the DB table and project folder.

Conclusion

In this tutorial, you have learned how to upload images using jquery and ajax without refresh the whole web page.

Recommended PHP Tutorials

Images mentioned above related to PHP are either copyright property of respective image owners.

Rabins Sharma Lamichhane

Rabins Sharma Lamichhane is senior ICT professional who talks about #it, #cloud, #servers, #software, and #innovation. Rabins is also the first initiator of Digital Nepal. Facebook: rabinsxp Instagram: rabinsxp

Leave a Reply

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