使用方法:
-
var myUpload = $(element).upload({ name: 'file', action: '', enctype: 'multipart/form-data', params: {}, autoSubmit: true, onSubmit: function() {}, onComplete: function(response) {}, onSelect: function() {} });
实例:
-
[javascript] view plain copy $("#button-import").upload({ name: 'upload', // <input name="file" /> action: '${pageContext.request.contextPath}/importSubarea.action', // 提交请求action路径 enctype: 'multipart/form-data', // 编码格式 autoSubmit: true, // 选中文件提交表单 onComplete: function(response) {// 请求完成时 调用函数 if(response=="success"){ alert("数据导入成功!"); } } });