Articles

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 the owner of RabinsXP who is constantly working for increasing the Internet of Things (IoT) in Nepal. He also builds android apps and crafts beautiful websites. He is also working with various social services. The main aim of Lamichhane is to digitally empower the citizens of Nepal and make the world spiritually sound better both in terms of technology and personal development. Rabins is also the first initiator of Digital Nepal.

Related Articles

Leave a Reply

Your email address will not be published.

Back to top button