ajax php多文件上传代码_PHP教程

php中文网
发布: 2016-07-13 17:07:43
原创
1165人浏览过

码上飞
码上飞

码上飞(CodeFlying) 是一款AI自动化开发平台,通过自然语言描述即可自动生成完整应用程序。

码上飞 138
查看详情 码上飞
ajax php教程多文件上传代码 (function(){   var d = document, w = window; /**  * get element by id  */  function get(element){  if (typeof element == "string")   element = d.getelementbyid(element);  return element; } /**  * attaches event to a dom element  */ function addevent(el, type, fn){  if (w.addeventlistener){   el.addeventlistener(type, fn, false);  } else if (w.attachevent){   var f = function(){     fn.call(el, w.event);   };      el.attachevent('on' + type, f)  } } /**  * creates and returns element from html chunk  */ var toelement = function(){  var div = d.createelement('div');  return function(html){   div.innerhtml = html;   var el = div.childnodes[0];   div.removechild(el);   return el;  } }(); function hasclass(ele,cls){  return ele.classname.match(new regexp('(s|^)'+cls+'(s|$)')); } function addclass(ele,cls) {  if (!hasclass(ele,cls)) ele.classname += " "+cls; } function removeclass(ele,cls) {  var reg = new regexp('(s|^)'+cls+'(s|$)');  ele.classname=ele.classname.replace(reg,' '); } // getoffset function copied from jquery lib (http://jquery.com/) if (document.documentelement["getboundingclientrect"]){  // get offset using getboundingclientrect  // http://ejohn.org/blog/getboundingclientrect-is-awesome/  var getoffset = function(el){   var box = el.getboundingclientrect(),   doc = el.ownerdocument,   body = doc.body,   docelem = doc.documentelement,      // for ie   clienttop = docelem.clienttop || body.clienttop || 0,   clientleft = docelem.clientleft || body.clientleft || 0,      // in internet explorer 7 getboundingclientrect property is treated as physical,   // while others are logical. make all logical, like in ie8.        zoom = 1;      if (body.getboundingclientrect) {    var bound = body.getboundingclientrect();    zoom = (bound.right - bound.left)/body.clientwidth;   }      if (zoom > 1){    clienttop = 0;    clientleft = 0;   }      var top = box.top/zoom + (window.pageyoffset || docelem && docelem.scrolltop/zoom || body.scrolltop/zoom) - clienttop,   left = box.left/zoom + (window.pagexoffset|| docelem && docelem.scrollleft/zoom || body.scrollleft/zoom) - clientleft;        return {    top: top,    left: left   };  }   } else {  // get offset adding all offsets  var getoffset = function(el){   if (w.jquery){    return jquery(el).offset();   }         var top = 0, left = 0;   do {    top += el.offsettop || 0;    left += el.offsetleft || 0;   }   while (el = el.offsetparent);      return {    left: left,    top: top   };  } } function getbox(el){  var left, right, top, bottom;   var offset = getoffset(el);  left = offset.left;  top = offset.top;         right = left + el.offsetwidth;  bottom = top + el.offsetheight;       return {   left: left,   right: right,   top: top,   bottom: bottom  }; } /**  * crossbrowser mouse coordinates  */ function getmousecoords(e){    // pagex/y is not supported in ie  // http://www.quirksmode.org/dom/w3c_css教程om.html     if (!e.pagex && e.clientx){   // in internet explorer 7 some properties (mouse coordinates) are treated as physical,   // while others are logical (offset).   var zoom = 1;    var body = document.body;      if (body.getboundingclientrect) {    var bound = body.getboundingclientrect();    zoom = (bound.right - bound.left)/body.clientwidth;   }   return {    x: e.clientx / zoom + d.body.scrollleft + d.documentelement.scrollleft,    y: e.clienty / zoom + d.body.scrolltop + d.documentelement.scrolltop   };  }    return {   x: e.pagex,   y: e.pagey  };   } /**  * function generates unique id  */   var getuid = function(){  var id = 0;  return function(){   return 'valumsajaxupload' + id++;  } }(); function filefrompath(file){  return file.replace(/.*(/|)/, "");    } function getext(file){  return (/[.]/.exec(file)) ? /[^.]+$/.exec(file.tolowercase()) : ''; }    /**  * cross-browser way to get xhr object   */ var getxhr = function(){  var xhr;    return function(){   if (xhr) return xhr;        if (typeof xmlhttprequest !== 'undefined') {    xhr = new xmlhttprequest();   } else {    var v = [     "microsoft.xmlhttp",     "msxml2.xmlhttp.5.0",     "msxml2.xmlhttp.4.0",     "msxml2.xmlhttp.3.0",     "msxml2.xmlhttp.2.0"         ];        for (var i=0; i = box.left) && (c.x = box.top) && (c.y

php #file_upload.php 2009-11-06
 $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'; 
 }
?>

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/630134.htmlTechArticle!doctype html public -//w3c//dtd xhtml 1.0 transitional//en http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml head meta http-equiv=con...
相关标签:
PHP速学教程(入门到精通)
PHP速学教程(入门到精通)

PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!

下载
来源:php中文网
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
开源免费商场系统广告
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号