Upload(上传标签) * 说明: 该上传标签是老实现方式,不好用,建议使用轻量级标签WebUploader标签。 **示例:** ``` <t:upload name="instruction" dialog="false" queueID="instructionfile" view="true" auto="true" uploader="systemController.do?save" extend="pic" id="instruction" formData="documentTitle"> </t:upload> ``` **参数:** | 属性名| 类型| 描述| 是否必须| 默认值| | -------- | ----- | ---- | | id| string| 上传控件唯一标示| 是| null| | name| string| 控件name| 是| null| | formData| string| 上传文件提交后台的其他表单参数取ID| 否| null| | uploader| string| 上传提交路径| 是| null| | extend| string| 上传文件扩展名(可选类型组1,pic[*.jpg;*,jpeg;*.png;*.gif;*.bmp;*.ico;*.tif],2,office[*.doc;*.docx;*.txt;*.ppt;*.xls;*.xlsx;*.html;*.htm ])| 是| | | buttonText| string| 控件按钮显示文本| 否| 浏览| | multi| boolean| 是否允许选择多文件| 否| TRUE| | queueID| string| 显示预上传文件列表的对象ID| 否| TRUE| | dialog| boolean| 是否是对话框模式打开上传控件| 否| TRUE| | callback| string| 所有文件上传完成后回调函数| 否| null| | auto| boolean| 是否是自动上传| 否| TRUE| | onUploadSuccess| string| 上传成功的处理函数| 否| null| | view| string| 是否生成查看删除链接默认false,如为true需要在后台返回JSON中添加查看参数(viewhref)和删除参数(delurl)| 否| null| | formId| string| 后台接受表单id, 不可与formData同时使用| 否| null| | fileSizeLimit| string| 上传文件大小设置| 否| 15MB| | outhtml| boolean| 是否生成HTML(true/false)一个页面多个upload字段支持| 否| TRUE| | onUploadStart| string| 上传之前处理函数,只传函数名,该函数有个参数为file对象| 否| null| | height| int| 自定义上传按钮高度(jeecg_3.7.7版本功能)| 否| 18 | | width| int| 自定义上传按钮高度(jeecg_3..7.7版本功能)| 否| 80 | 上传文件如何不启动SWF文件转换 > UploadFile 对象参数Swfpath设置空值的时候,表示不执行swf文件转换;设置“swfpath”值,表示上传同时执行文件转换; ``` /** * 保存文件 * * @param document * @return * @throws Exception */ @RequestMapping(params = "saveFiles", method = RequestMethod.POST) @ResponseBody public AjaxJson saveFiles(HttpServletRequest request, HttpServletResponse response, TSDocument document) { AjaxJson j = new AjaxJson(); Map<String, Object> attributes = new HashMap<String, Object>(); TSTypegroup tsTypegroup=systemService.getTypeGroup("fieltype","文档分类"); TSType tsType = systemService.getType("files","附件", tsTypegroup); String documentId = oConvertUtils.getString(request.getParameter("documentId"));// 文件ID String documentTitle = oConvertUtils.getString(request.getParameter("documentTitle"));// 文件标题 if (StringUtil.isNotEmpty(documentId)) { document.setId(documentId); document = systemService.getEntity(TSDocument.class, documentId); document.setDocumentTitle(documentTitle); } document.setSubclassname(MyClassLoader.getPackPath(document)); document.setCreatedate(DateUtils.gettimestamp()); document.setTSType(tsType); UploadFile uploadFile = new UploadFile(request, document); uploadFile.setCusPath("files"); //设置weboffice转化【不设置该字段,则不做在线预览转化】 uploadFile.setSwfpath("swfpath"); document = systemService.uploadFile(uploadFile); attributes.put("url", document.getRealpath()); attributes.put("fileKey", document.getId()); attributes.put("name", document.getAttachmenttitle()); attributes.put("viewhref", "commonController.do?objfileList&fileKey=" + document.getId()); attributes.put("delurl", "commonController.do?delObjFile&fileKey=" + document.getId()); j.setMsg("文件添加成功"); j.setAttributes(attributes); return j; } ``` **DEMO界面展示:**