博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jquery.fileupload插件 ie9下不支持上传
阅读量:4625 次
发布时间:2019-06-09

本文共 2060 字,大约阅读时间需要 6 分钟。

根据https://github.com/blueimp/jQuery-File-Upload/wiki/Browser-support

The following browsers support at least one form of  style file uploads, either via  or via the :

Desktop browsers

  • Google Chrome
  • Apple Safari 4.0+
  • Mozilla Firefox 3.0+
  • Opera 11.0+
  • Microsoft Internet Explorer 6.0+

1、要支持上传.必须支持 style file uploads, either via  or via the ,

这三种中的一种,所以我选择了最后一种

,根据链接下的地址https://cmlenz.github.io/jquery-iframe-transport/

1、下载jquery.iframe-transport.js。然后引入该js文件

2、根据 https://cmlenz.github.io/jquery-iframe-transport/

加入参数对于ie10以下的浏览器加入参数:iframe=true

var url = ctx	+ fileServiceURL.saveFiles;//上传文件的地址		 		 var iframe = false; 			if($.browser.msie  && $.browser.version < 10){  				iframe = true; 			}	 		$('#' + _this.ctlID ).fileupload({			url: url,			//forceIframeTransport: forceIframeTransport,			 iframe: iframe,			dataType: 'json',			//datatype: dataType,			autoUpload: true,			//sequentialUploads : true,			formData: {signUploadFile: _this.signature},			maxFileSize: 5000000, // 5 MB			previewMaxWidth: 100,			previewMaxHeight: 100,			previewCrop: true		}).on('fileuploadadd', function (e, data) {			 			pageLock("show");		}).on("fileuploadsubmit", function(e, data){			if(_this.signature && !_this.validSignatureUSB()){				pageLock("hide");				return false;			}			return true;		}).on('fileuploaddone', function (e, data) {			pageLock("hide"); 			if((typeof data.result) == "undefined"){				oAlert("不支持上传该格式的文件");			}else{				$.each(data.result.data, function(index){					//console.log("new file " + this.fileID);					_this.addFile(this.filename, this.fileID,  this.contentType, this.digestValue,  this.digestAlgorithm,  this.certificate, true);				});			}			 		}).on('fileuploadfail', function (e, data) {			pageLock("hide");			if((typeof data.result) == "undefined"){				oAlert("可能您上传的文件格式不被支持!!!"); 			}else{				$.each(data.result.files, function (index, file) {					var error = $('').text(file.error);					$(data.context.children()[index])						.append('
') .append(error); }); } });

  

 

转载于:https://www.cnblogs.com/silentjesse/p/3770253.html

你可能感兴趣的文章
spi驱动无法建立spidev问题
查看>>
ANDROID开发之SQLite详解
查看>>
PHP之时间函数
查看>>
Python open()完整参数
查看>>
django里面DTL使用for循环时,获取当前循环次数使用{{forloop.counter}}
查看>>
Java基础——Java集合(二)
查看>>
详解如何让Android UI设计性能更高效
查看>>
使用KNN算法对鸢尾花数据集进行分类处理
查看>>
java排序-按照实体的多种属性值进行排序(ComparableComparator/ComparatorChain)
查看>>
Django模板语言
查看>>
Django路由系统
查看>>
提高生产性工具(四) - XML数据库的尝试
查看>>
ural 1005 Stone Pile DP
查看>>
day15—jQuery UI之widgets插件
查看>>
使用ssh和putty操控远程的linux server
查看>>
BZOJ1499: [NOI2005]瑰丽华尔兹
查看>>
过滤器
查看>>
Redis是什么?
查看>>
JavaScript 学习总结
查看>>
iOS开发——UI进阶篇(十)导航控制器、微博详情页、控制器的View的生命周期...
查看>>