PHP AJAX文件上传 [英] PHP AJAX file upload

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

问题描述

我已经找遍了计算器和一般的互联网,我无法找到一个简单的AJAX文件上传(只要形成提交)。那些我发现是不够灵活,不适合我的目的。如果我能ajust这个脚本文件上传,这将是巨大的:

i've looked all over stackoverflow and the general internet and i can't find a simple AJAX file uploader (Just form submission). The ones i have found aren't flexible enough and don't fit my purpose. If i could ajust this script to file uploads, that would be great:

<script type="text/javascript">
 function upload(str)
 {
 if (str.length==0)
 { 
document.getElementById("txtHint").innerHTML="";
 return;
  }
 if (window.XMLHttpRequest)
    {// code for IE7+, Firefox, Chrome, Opera, Safari
   xmlhttp=new XMLHttpRequest();
   }
 else
   {// code for IE6, IE5
   xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
   }
 xmlhttp.onreadystatechange=function()
   {
   if (xmlhttp.readyState==4 && xmlhttp.status==200)
     {
     document.getElementById("hint").innerHTML=xmlhttp.responseText;
     }
   }
 xmlhttp.open("GET","ajax/link.php?q="+str,true);
 xmlhttp.send();
 }

在HTML我将不得不

<input type='file' onblur='upload(this.value)'>

感谢

推荐答案

下面是一个简单的Ajax文件上传

Here is a simple ajax file uploader

Uploadify

Uploadify

如果你不想让闪光灯,你可以用这一个;

And if you don't want flash, you may use this one;

AxUploader

AxUploader

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

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