This can be done via a hidden <iframe>
create a form and hidden iframe.
The PHP script uploads the image file on the server
This second JS
function is used to display the image uploaded. It takes the address of the file loaded on the server and adds in a DIV (with "innerHTML") an <img> tag with the image uploaded.
hope it works..!