下载地址

一款支持多个图片文件批量上传插件代码下载,下载包里有服务端获取图片方法,是php语言。/** 服务器地址,成功返回,失败返回参数格式依照jquery.ajax习惯;* 其他参数同WebUploader*/$("#test").diyUpload({ url:"server/fileupload.php", success:function( data ) { console.info( data ); }, error:function( err ) { console.info( err ); }});$("#as").diyUpload({ url:"server/fileupload.php", success:function( data ) { console.info( data ); }, error:function( err ) { console.info( err ); }, buttonText : "选择文件", chunked:true, // 分片大小 chunkSize:512 * 1024, //最大上传的文件数量, 总文件大小,单个文件大小(单位字节); fileNumLimit:50, fileSizeLimit:500000 * 1024, fileSingleSizeLimit:50000 * 1024, accept: {}});服务端用法php代码如下// Make sure file is not cached (as it happens for example on iOS devices)header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");header("Cache-Control: no-store, no-cache, must-revalidate");header("Cache-Control: post-check=0, pre-check=0", false);header("Pragma: no-cache");// Support CORS// header("Access-Control-Allow-Origin: *");// other CORS headers if any...if ($_SERVER["REQUEST_METHOD"] == "OPTIONS") { exit; // finish preflight CORS requests here}if ( !empty($_REQUEST[ "debug" ]) ) { $random = rand(0, intval($_REQUEST[ "debug" ]) ); if ( $random === 0 ) { header("HTTP/1.0 500 Internal Server Error"); exit; }}// header("HTTP/1.0 500 Internal Server Error");// exit;// 5 minutes execution time@set_time_limit(5 * 60);// Uncomment this one to fake upload timeusleep(5000);// Settings// $targetDir = ini_get("upload_tmp_dir") . DIRECTORY_SEPARATOR . "plupload";$targetDir = "upload_tmp";$uploadDir = "upload";$cleanupTargetDir = true; // Remove old files$maxFileAge = 5 * 3600; // Temp file age in seconds// Create target dirif (!file_exists($targetDir)) { @mkdir($targetDir);}// Create target dirif (!file_exists($uploadDir)) { @mkdir($uploadDir);}// Get a file nameif (isset($_REQUEST["name"])) { $fileName = $_REQUEST["name"];} elseif (!empty($_FILES)) { $fileName = $_FILES["file"]["name"];} else { $fileName = uniqid("file_");}$md5File = @file("md5list.txt", FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);$md5File = $md5File ? $md5File : array();if (isset($_REQUEST["md5"]) && array_search($_REQUEST["md5"], $md5File ) !== FALSE ) { die("{"jsonrpc" : "2.0", "result" : null, "id" : "id", "exist": 1}");}$filePath = $targetDir . DIRECTORY_SEPARATOR . $fileName;$uploadPath = $uploadDir . DIRECTORY_SEPARATOR . $fileName;// Chunking might be enabled$chunk = isset($_REQUEST["chunk"]) ? intval($_REQUEST["chunk"]) : 0;$chunks = isset($_REQUEST["chunks"]) ? intval($_REQUEST["chunks"]) : 1;// Remove old temp filesif ($cleanupTargetDir) { if (!is_dir($targetDir) || !$dir = opendir($targetDir)) { die("{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}"); } while (($file = readdir($dir)) !== false) { $tmpfilePath = $targetDir . DIRECTORY_SEPARATOR . $file; // If temp file is current file proceed to the next if ($tmpfilePath == "{$filePath}_{$chunk}.part" || $tmpfilePath == "{$filePath}_{$chunk}.parttmp") { continue; } // Remove temp file if it is older than the max age and is not the current file if (preg_match("/.(part|parttmp)$/", $file) && (@filemtime($tmpfilePath) < time() - $maxFileAge)) { @unlink($tmpfilePath); } } closedir($dir);}// Open temp fileif (!$out = @fopen("{$filePath}_{$chunk}.parttmp", "wb")) { die("{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}");}if (!empty($_FILES)) { if ($_FILES["file"]["error"] || !is_uploaded_file($_FILES["file"]["tmp_name"])) { die("{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}"); } // Read binary input stream and append it to temp file if (!$in = @fopen($_FILES["file"]["tmp_name"], "rb")) { die("{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}"); }} else { if (!$in = @fopen("php://input", "rb")) { die("{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}"); }}while ($buff = fread($in, 4096)) { fwrite($out, $buff);}@fclose($out);@fclose($in);rename("{$filePath}_{$chunk}.parttmp", "{$filePath}_{$chunk}.part");$index = 0;$done = true;for( $index = 0; $index < $chunks; $index++ ) { if ( !file_exists("{$filePath}_{$index}.part") ) { $done = false; break; }}if ( $done ) { if (!$out = @fopen($uploadPath, "wb")) { die("{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}"); } if ( flock($out, LOCK_EX) ) { for( $index = 0; $index < $chunks; $index++ ) { if (!$in = @fopen("{$filePath}_{$index}.part", "rb")) { break; } while ($buff = fread($in, 4096)) { fwrite($out, $buff); } @fclose($in); @unlink("{$filePath}_{$index}.part"); } flock($out, LOCK_UN); } @fclose($out);}// Return Success JSON-RPC responsedie("{"jsonrpc" : "2.0", "result" : null, "id" : "id"}");

dd:

diyUpload - jQuery多张图片批量上传插件相关推荐

  1. php图片批量上传插件下载,jQuery的多图片批量上传插件

    jQuery的多图片批量上传插件 js代码 $(function(){ //上传图片 var $tgaUpload = $('#goodsUpload').diyUpload({ url:'uploa ...

  2. 基于jQuery很牛X的批量上传插件

    上传功能应该是每个网站必备的工具之一,因此出现了出现了很多各式各样的上传插件! 本文基于个人经验和使用从插件的:交互体验,易用性,文档,美观度出发,为大家推荐三款很NX的批量上传插件! 下面三款插件的 ...

  3. jQuery图片批量上传插件源码,支持批量上传、预览、删除、放大,可配置上传数量、上传大小、追加方式,含详细使用文档

    jQuery图片批量上传插件源码,支持批量上传.预览.删除.放大,可配置上传数量.上传大小.追加方式,含详细使用文档 程序包内含使用Demo 完整程序源代码:jQuery图片批量上传插件源码 上传前 ...

  4. php图片批量上传插件下载,vue.js图片批量上传插件

    vue.js图片批量上传插件是一款基于vue.js框架的图片上传控件,适用于手机端的图片上传代码,支持批量上传,拖到图片上传,显示文件数量和大小等功能 js代码 // import up from ' ...

  5. jQuery图片批量上传插件

    下载地址 jQuery图片批量上传网页插件,可以实现上传图片预览拖拽排序,编辑图片功能支持多个多图上传功能特效. dd:

  6. php 批量上传图片插件,ajaxImageUpload——一个jQuery图片批量上传插件

    ajaxImageUpload 原创jQuery图片上传插件,支持批量上传.预览.删除.放大.上传数量.上传大小.追加方式配置以及上传前.上传中和上传后的回调函数. 演示地址:http://www.g ...

  7. 批量上传插件(flash,html5,jquery)

    1.jQuery File Upload 官网:http://blueimp.github.com/jQuery-File-Upload/ 在线示例:http://blueimp.github.com ...

  8. jquery uploadify 多文件上传插件 使用经验

    2019独角兽企业重金招聘Python工程师标准>>> Uploadify 官网:http://www.uploadify.com/ 一.如何使用呢? 官网原文:http://www ...

  9. php模板多图上传插件,PHP+jQuery+Ajax多图片上传插件

    注:本地预览无效,需要在服务断运行 使用方法 HTML 首先我们在页面上放置个上传按钮,使用POST提交到ajax.php.#ul_pics 用来显示上传完毕后的图片.关于按钮.进度条.图片垂直居中样 ...

最新文章

  1. 开源项目PullToRefresh详解(一)——PullToRefreshListView
  2. -9 逆序输出一个整数的各位数字_计算机基础知识: 信息数字化
  3. java 3des解密过程_6. Java 加解密技术系列之 3DES
  4. jdk8 cms g1gc_JDK 14:CMS GC是OBE
  5. LeetCode 71. 简化路径(栈)
  6. Linux系统编程:fork函数的使用【循环创建N个子线程】
  7. spark 写本地文件_(纯干货建议收藏)一次GC引发的Spark调优大全
  8. python爬虫从入门到放弃-python爬虫从入门到放弃(三)之 Urllib库的基本使用
  9. html登陆部分项目答辩演讲稿,D-POTDR项目答辩讲稿材料
  10. 小红书数据分析工具丨借助数据教你分分钟锁定优质达人
  11. MySql生日闰月处理
  12. 不知如何选股?不知哪种指标策略可靠?量化分析比较DMA、DMI、MACD、KDJ、BOLL指标策略收益情况
  13. Required request body is missing 错误解决
  14. 挑战杯获奖作品_精仪科协 | 挑战杯获奖作品人物专访——刘宇航、郑重
  15. MySQL-V5.7 压缩包版安装教程
  16. H3C SecPath F100 系列防火墙基本配置
  17. mysql字符集mysqldump_Mysqldump 字符集问题
  18. htc 8x android,htc8x怎么样 htc8x测评【图解】
  19. Centos7 Radius服务搭建
  20. FPA笔记五 计算ILF/EIF功能点

热门文章

  1. dos命令获取当前日期并格式化
  2. tcp socket 和 socket文件
  3. Mysql修改表中字段名称、字段类型
  4. vue+高德地图实现多边形范围内标点
  5. java开发的游戏测试_用java编写。模拟一个简单的测试打字速度的游戏
  6. 原码一位乘、补码一位乘(校正法、布斯法)、补码两位乘
  7. Booth(布斯)算法——补码乘法运算过程
  8. 为什么要进行傅立叶变换?如何用Matlab实现快速傅立叶变换?
  9. 2021-07-06 黑盒测试(持续更新)
  10. 【bzoj3238】[Ahoi2013]差异