如何使用AJAX上传图像

How can I send an image on my server using AJAX to a remote PHP server which is also mine? I don't know how to send and how to save using PHP. I tried to put the image in an iframe and send its content using AJAX like below but nothing happened as you might guess... It returns a message that show it is receiving some stuff and creates a very small broken image.

...
var url = "www.xyz.com/AJAX.php?content=" + document.getElementById('iframe').contentWindow.document;
...

here is a good example you could use Ajax Image Uploading

Have you had a look at jQuery yet? Its really easy doing ajax calls with it.

For your Image Uploading you might wanna have a look at jquery Forms, it has some sample codes in it here : http://www.malsup.com/jquery/form/#getting-started