 <p>If you want do do it in ajax, you should put your form inside an iframe, so when you upload the image, only a small part of the page (the form) is sent to your server.</p> <p>After that, you can use upload.php response to get the name and path of uploaded image, and then you can just change the src of the img tag.</p>