jquery.uploadify上传插件HTML5版中文api使用说明

插件官网文档:http://www.uploadify.com/documentation/

H5版下载地址:https://download.csdn.net/download/u010075697/10751185

后台代码:https://www.cnblogs.com/cyh92/p/9798155.html

uploadify分为Flash版和HTML5版,这里介绍的是H5版

首先引用外部资源,jquery.min.js,jquery.uploadifive.min.js或jquery.uploadifive.js和uploadifive.css

  1 $('#file_upload').uploadifive({
  2 
  3 'auto':false,//设置auto为true,当文件被添加至上传队列时,将会自动上传
  4 
  5 'buttonClass':'btn',//为上传按钮添加类名
  6 
  7 'buttonText':'选择图片',//定义显示在默认按钮上的文本
  8 
  9 'dnd':true,//如果设置为 false , 拖放功能将不被启用
 10 
 11 'fileObjName':'11',//定义上传数据处理文件中接收数据使用的文件对象名
 12 
 13 'fileSizeLimit':1000,//上传文件大小限制,单位KB
 14 
 15 'fileType':'image',//允许上传的文件类型
 16 
 17 //'checkScript': 'check-exists.php',//定义检查目标文件夹中是否存在同名文件的脚本文件路径
 18 
 19 //'formData': {
 20 
 21 //    'timestamp': '',
 22 
 23 //    'token': ''
 24 
 25 //},//定义在文件上传时需要一同提交的其他数据对象
 26 
 27 'height':20,//上传按钮的高度(单位:像素)
 28 
 29 'width':100,//上传按钮的宽度(单位:像素)
 30 
 31 // 'itemTemplate' : '',//指定上传队列的HTML
 32 
 33 'method':'post',//上传文件的提交方法,取值‘post‘或‘get‘。
 34 
 35 'multi':true,//设置值为false时,一次只能选中一个文件
 36 
 37 //'overrideEvents':['onProgress'],//该项定义了一组默认脚本中你不想执行的事件名称
 38 
 39 'queueSizeLimit':12,//上传队列中一次可容纳的最大条数
 40 
 41 'removeCompleted':true,//不设置该选项或者将其设置为false,将使上传队列中的项目始终显示于队列中,直到点击了关闭按钮或者队列被清空
 42 
 43 //  'simUploadLimit': 10,//所述多个文件同时上传 , 可以在任何给定时间
 44 
 45 'truncateLength':1,//截断文件名字符
 46 
 47 'uploadLimit':2,//定义允许的最大上传数量
 48 
 49 'queueID':'queue',//queueID选项允许你设置一个拥有唯一ID的DOM元素来作为显示上传队列的容器
 50 
 51 'uploadScript':'up.ashx',//服务器处理脚本的路径
 52 
 53 'onUploadComplete':function(file, data) {
 54 
 55 //
 56 
 57 },//每一个文件上传完成都会触发该事件,不管是上传成功还是上传失败
 58 
 59 //'onAddQueueItem':function(file) {
 60 
 61 //  // alert('The file ' + file.type + ' was added to the queue!');
 62 
 63 //},//将一个新文件添加到上传队列时触发
 64 
 65 //'onCancel': function () {
 66 
 67 //    alert('The file ' + file.name + ' was cancelled!');
 68 
 69 //},//设置onCancel选项,在文件上传被取消时,将允许运行一个自定义函数
 70 
 71 //'onCheck': function (file, exists) {
 72 
 73 //    if (exists) {
 74 
 75 //        alert('The file ' + file.name + ' exists on the server.');
 76 
 77 //    }
 78 
 79 //},//当检测该文件已存在时执行
 80 
 81 //'onClearQueue': function (queue) {
 82 
 83 //    queue.css('border', '2px solid #F00');
 84 
 85 //},//设置onClearQueue选项,上传队列清空(激活ancel方法)时,将允许运行一个自定义函数
 86 
 87 //'onDestroy': function () {
 88 
 89 //    alert('Oh noes!  you destroyed UploadiFive!');
 90 
 91 //},//销毁Uploadify实例(调用destroy方法)时触发该事件
 92 
 93 //'onDrop': function (file, fileDropCount) {
 94 
 95 //    alert(fileDropCount + ' files were dropped onto the queue.');
 96 
 97 //},//当文件被放到该队列文件
 98 
 99 //'onError': function (errorType) {
100 
101 //    alert('The error was: ' + errorType);
102 
103 //},//选择文件发生错误时执行
104 
105 //'onFallback': function () {
106 
107 //    alert('Oops!  You have to use the non-HTML5 file uploader.');
108 
109 //},//浏览器检测不到兼容时触发该事件
110 
111 //'onInit': function () {
112 
113 //    alert('Add files to the queue to start uploading.');
114 
115 //},//调用Uploadify初始化结束时触发该事件
116 
117 //'onProgress': function (file, e) {
118 
119 //    if (e.lengthComputable) {
120 
121 //        var percent = Math.round((e.loaded / e.total) * 100);
122 
123 //    }
124 
125 //    file.queueItem.find('.fileinfo').html(' - ' + percent + '%');
126 
127 //    file.queueItem.find('.progress-bar').css('width', percent + '%');
128 
129 //},//上传进度更新时触发该事件
130 
131 //'onQueueComplete': function (uploads) {
132 
133 //    alert(uploads.successful + ' files were uploaded successfully.');
134 
135 //},//队列中的所有文件被处理完成时触发该事件
136 
137 //'onSelect': function (queue) {
138 
139 //    alert(queue.queued + ' files were added to the queue.');
140 
141 //},//每添加一个文件至上传队列时触发该事件
142 
143 //'onUpload': function (filesToUpload) {
144 
145 //    alert(filesToUpload + ' faddfd.');
146 
147 //},//上传操作时触发
148 
149 //'onUploadComplete': function (file, data) {
150 
151 //    alert('The file ' + file.name + ' uploaded successfully.');
152 
153 //},//每一个文件上传完成都会触发该事件,不管是上传成功还是上传失败
154 
155 'onUploadFile':function(file) {
156 
157 alert('The file '+file.name+' is being uploaded.');
158 
159 },//开始上传时触发
160 
161 });
View Code

 

转载于:https://www.cnblogs.com/cyh92/p/6907347.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值