如何使用AJAX上传图片 [英] How to upload image using AJAX

查看:106
本文介绍了如何使用AJAX上传图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么能发送图像使用AJAX到远程PHP服务器,这也是我的我的服务器上?我不知道如何发送和如何保存使用PHP。我试图把图像中的iframe和发送使用AJAX的内容如下图所示,但什么都没有发生,你可能已经猜到......它返回显示它正在接受一些东西的消息,并创建一个非常小的破碎的形象。

  ...
VAR URL =www.xyz.com/AJAX.php?content=+的document.getElementById(IFRAME)contentWindow.document。
...
 

解决方案

在这里,你可以使用一个很好的例子的阿贾克斯图片上传

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

这篇关于如何使用AJAX上传图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆