wordpress upload image using ajax.

Some time you will need to

upload image using Ajax

Here i am going to give you full code to save image in a folder and show preview.

There are many ways to upload image using ajax in wordpress like you can use HTML form then you will call Ajax on submit form but some time you may face a situation where does not want to form just input file and a button to upload image.

First create an input file with button, just copy below html code.

Ajax call

Don’t forget to include Jquery library.

Upload image

Put this code to your theme functions.php

Gaurav Kumar

Hi, my name is Gaurav Kumar and I specialize in Computer Software industry. I have been working as a Software Developer from last 3+ years,and its my passion to learn new technology and sharing what I've learned.