Mehmed
Mehmed

Reputation: 3040

How to upload image using 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;
...

Upvotes: 3

Views: 10967

Answers (2)

Angelo
Angelo

Reputation: 1721

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

Upvotes: 0

Duke
Duke

Reputation: 1731

here is a good example you could use Ajax Image Uploading

Upvotes: 1

Related Questions