php专区

 首页 > php专区 > PHP高级 > 文件上传 > ajax php多文件上传代码 - php上传下载

ajax php多文件上传代码 - php上传下载

分享到:
【字体:
导读:
          !doctypehtmlpublic-//w3c//dtdxhtml1.0transitional//enhttp://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtdhtmlxmlns=http......

ajax php多文件上传代码

  1. public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"
  2. "http://www.w3.org/1999/xhtml"
  3.  
  4. "content-type" content="text/html; charset=utf-8" /> 
  5. ajax php多文件上传代码 
  6.  
  7.  
  8.  
  9. "errorremind">

     
  10. "unloadpic" type="button" value="上传图片" /> 
  11. "uploadedname">
 
  • "text/javascript" src="../js/ajaxupload.js"
  • "text/javascript"
  • window.onload = function(){ 
  •  var obtn = document.getelementbyid("unloadpic"); 
  •  var oshow = document.getelementbyid("uploadedname"); 
  •  var oremind = document.getelementbyid("errorremind");  
  •  new ajaxupload(obtn,{ 
  •   action:"file_upload.php"
  •   name:"upload"
  •   onsubmit:function(file,ext){ 
  •    if(ext && /^(jpg|jpeg|png|gif)$/.test(ext)){ 
  •     //ext是后缀名 
  •     obtn.value = "正在上传…"
  •     obtn.disabled = "disabled"
  •    }else{  
  •     oremind.style.color = "#ff3300"
  •     oremind.innerhtml = "不支持非图片格式!"
  •     return false; 
  •    } 
  •   }, 
  •   oncomplete:function(file,response){ 
  •    obtn.disabled = ""
  •    obtn.value = "再上传一张图片"
  •    oremind.innerhtml = ""
  •    var newchild =  document.createelement("li"); 
  •    newchild.innerhtml = file; 
  •    oshow.appendchild(newchild); 
  •   } 
  •  }); 
  • }; 
  •  
  •  
  •  
  • //开源代码phpfensi.com 
  •  $file_path = '../../../uploads/'
  •  $file_up = $file_path.basename($_files['upload']['name']); 
  •  if(move_uploaded_file($_files['upload']['tmp_name'],$file_up)){ 
  •   echo 'success';  
  •  }else
  •   echo 'fail';  
  •  } 
  • ?> 
  • 分享到:
    php无刷新利用iframe实现页面无刷新上传...
    php无刷新利用iframe实现页面无刷新上传文件 利用form表单的target属性和iframe 一、上传文件的一个php方法 该方法接受一个$file参数,该参数为从客户端获取的$_files变量,返回重新命名后的文件名,如果上传失败,则返回空字符串,php代码如下: function uploadfile($file) {     ...
    php文件上传类与详解 - php上传下载
    php文件上传类与详解 php 配置中的 upload_tmp_dir 这个参数进行比较,如果文件在这个目录下面,那么 move_uploaded_file 才会进行移动操作,而且这个比较是大小写敏感,/ 在windows 下面也是不一样的,而在php配置文件解析的时候,会调用一个realpath 函数,也就是是说,你在move_uploaded_file 之前...
    •         php迷,一个php技术的分享社区,专属您自己的技术摘抄本、收藏夹。
    • 在这里……