Home > Backend Development > PHP Tutorial > Two php ajax file upload codes (1/4)_PHP tutorial

Two php ajax file upload codes (1/4)_PHP tutorial

WBOY
Release: 2016-07-20 11:09:05
Original
927 people have browsed it

二款php ajax文件上传代码这两款ajax文件上传代码其实都是利用了js的iframe或ajax post来实现的下面来看看代码吧。

二款php教程 ajax文件上传代码
这两款ajax文件上传代码其实都是利用了js的iframe或ajax post来实现的下面来看看代码吧。



ajax file upload sample




<br><script language=网页特效> <br>// 上传函数 <br>function btn_send.onclick() { <br>data = "" <br>spliter = "-------7d8d733180846" <br>datadata = data + spliter + "rn" <br>datadata = data + "content-disposition: form-data; name="photofile"; filename="c:a.txt"rn" <br>// datadata = data + "content-type: image/pjpeg" + vbcrlf <br>datadata = data + "content-type: text/plain" + "rn" + "rn" <br>text = "my name is wilson lin." <br>postlength = text.length + data.length + 2 + spliter.length + 4 <br>package = data + text + "rn" + spliter + "--rn"</p>
<p>alert(package) <br>// 把xml文档发送到web服务器 <br>var xmlhttp = new activexobject("microsoft.xmlhttp"); <br>xmlhttp.open("post","./upload.php",false); <br>xmlhttp.setrequestheader("content-type", "multipart/form-data; boundary=-----7d8d733180846"); <br>xmlhttp.setrequestheader("content-length", postlength); <br>xmlhttp.send(package); <br>// 显示服务器返回的信息 <br>result.innerhtml=xmlhttp.responsetext; <br>} <br></script> <br>





 




1 2 3 4

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444843.htmlTechArticleTwo php ajax file upload codes. These two ajax file upload codes actually use js iframe or ajax. Let’s take a look at the code after posting it. Two PHP tutorials ajax file upload code...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template