How to upload image using AJAX

…衆ロ難τιáo~ 提交于 2019-12-10 19:01:52

问题


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;
...

回答1:


here is a good example you could use Ajax Image Uploading




回答2:


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



来源:https://stackoverflow.com/questions/9479805/how-to-upload-image-using-ajax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!