多文件上传
来源:互联网 发布:网络诈骗 刑事立案 编辑:程序博客网 时间:2024/05/16 07:21
基于HTML5的多文件上传
html5的上传文件标签,支持multiple属性,可以使我们很方便的选择多个文件进行上传。
前台上传文件页面
index.html
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>多文件上传实例</title></head><body><div style="width: 800px;height: auto;"> <div> <form action="upload.php" method="post" target="showInfo" enctype="multipart/form-data"> <input type="file" name="files[]" multiple="multiple"/><input type="submit" value="上传"> </form> </div> <div style="width: 100%;height: 200px;"> <iframe name="showInfo" src="about:blank" width="100%" height="100%"></iframe> </div></div></body></html>
后台获取的$_FILES
数组格式
array (size=1) 'files' => array (size=5) 'name' => array (size=2) 0 => string 'QQ截图20161101202109.png' (length=26) 1 => string 'test.html' (length=9) 'type' => array (size=2) 0 => string 'image/png' (length=9) 1 => string 'text/html' (length=9) 'tmp_name' => array (size=2) 0 => string 'D:\wamp64\tmp\phpFC7C.tmp' (length=25) 1 => string 'D:\wamp64\tmp\phpFC7D.tmp' (length=25) 'error' => array (size=2) 0 => int 0 1 => int 0 'size' => array (size=2) 0 => int 3587 1 => int 75
后台文件上传处理程序
upload.php
<?php/** * Created by PhpStorm. * User: zhezhao * Date: 2016/11/2 * Time: 9:45 */$res = [];for($i=0;$i<count($_FILES["files"]["name"]);$i++){ $tmp = explode(".",$_FILES["files"]["name"][$i]); $suffix_name = end($tmp); $path = __DIR__.DIRECTORY_SEPARATOR.time().".".$suffix_name; if(move_uploaded_file($_FILES["files"]["tmp_name"][$i],$path)){ $res[] = $path; }}echo "upload ".count($res)." files.";foreach ($res as $path){ echo "<p>".$path."</p>";}
基于FLASH的多文件上传
参考文档:
http://www.manongjc.com/article/222.html
http://www.uploadify.com/
0 0
- 文件上传(多文件)
- asp.net文件上传,多文件上传。
- 单文件上传、多文件上传
- struts2文件上传与多文件上传
- 单文件上传和多文件上传
- PHP文件上传功能 -- 多文件上传
- struts2文件上传(多文件上传)
- SpringMVC文件上传 多文件上传实例
- Struts2之文件上传,多文件上传
- SpringMVC文件上传 多文件上传实例
- 文件上传及多文件上传
- Spring boot 文件上传(多文件上传)
- Struts文件上传--2.多文件上传
- spring boot文件上传【多文件上传】
- FastDFS上传文件二 : 多文件上传
- 多文件上传
- 单/多文件上传
- 多个文件上传
- ”属性不能设置为“Int64”值。必须将该属性设置为类型为“Int32”的非 null 值。
- C++头文件的包含顺序研究
- 笔试面试题总结
- Js内存泄漏及解决方案
- 用到zlib库的程序运行时报错:无法定位程序输入点createfile2于动态链接库KERNEL32.DLL上
- 多文件上传
- 在AndroidMainfest.xml添加了写文件权限还是提示open failed:eacces (permission denied)
- css学习笔记
- Maven和Eclipse集成和构建多模块Maven项目
- 最大似然参数估计与贝叶斯参数估计
- ButterKnife在8.4的使用
- oj-7-D-三角形面积计算
- python环境搭建的一点经验
- InetAddress.getLocalHost() throws UnknownHostException