routeFilesUpload.jsp
资源名称:NetOffice.rar [点击查看]
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:4k
源码类别:
电子政务应用
开发平台:
Java
- <%
- pageContext.setAttribute("encodeFlag" , "false");
- String root = ConfigParaLoader.getParameter("rootUrl");
- if( request.getParameter("type") !=null && request.getParameter("type").equals("1") ) //上传文件
- {
- attachURL += SubPathGenerater.getSeperator() + SubPathGenerater.getSubPath( root + SubPathGenerater.getSeperator() + attachURL);
- routeValueBean = ( RouteValueBean )session.getAttribute( "routeValueBean" );
- //上传文件
- // Initialization
- mySmartUpload.initialize( pageContext );
- System.out.println(" the attachmentsize===" + ConfigParaLoader.getParameter("attachmentSize") );
- mySmartUpload.setTotalMaxFileSize( Integer.parseInt( ConfigParaLoader.getParameter("attachmentSize") ) );
- // Upload
- mySmartUpload.upload();
- mySmartUpload.save( root + SubPathGenerater.getSeperator() + attachURL );
- //保存已有信息
- if( mySmartUpload.getRequest().getParameter("routeName") != null )
- routeValueBean.setRouteName( mySmartUpload.getRequest().getParameter("routeName") );
- if( mySmartUpload.getRequest().getParameter("description") != null )
- routeValueBean.setDescription( mySmartUpload.getRequest().getParameter("description") );
- if( mySmartUpload.getRequest().getParameterValues("stepNos") != null )
- routeValueBean.setStepNos( mySmartUpload.getRequest().getParameterValues("stepNos") );
- if( mySmartUpload.getRequest().getParameter("workflowTypeId") != null )
- routeValueBean.setWorkflowTypeId( Integer.parseInt ( mySmartUpload.getRequest().getParameter("workflowTypeId") ) );
- Collection c = routeValueBean.getRouteFiles();
- for(int i=0;i<mySmartUpload.getFiles().getCount();i++)
- {
- com.vnex.intranet.upload.File myFile = mySmartUpload.getFiles().getFile(i);
- if (!myFile.isMissing())
- {
- WorkflowFileValueBean wf = new WorkflowFileValueBean();
- wf.setName( myFile.getFileName() );
- wf.setTitle( attachURL + "/" + myFile.getFileName() );
- wf.setDescription( myFile.getFileName() );
- c.add(wf);
- }
- }
- routeValueBean.setRouteFiles(c);
- session.setAttribute( "routeValueBean", routeValueBean );
- }
- if( request.getParameter("type") !=null && request.getParameter("type").equals("2") ) //删除文件
- {
- routeValueBean = ( RouteValueBean )session.getAttribute( "routeValueBean" );
- //保存已有信息
- routeValueBean.setRouteName( request.getParameter("routeName") );
- routeValueBean.setDescription( request.getParameter("description") );
- routeValueBean.setWorkflowTypeId(Integer.parseInt( request.getParameter("workflowTypeId") ));
- routeValueBean.setStepNos( request.getParameterValues("stepNos"));
- String files[] = request.getParameterValues("attachments");
- if(files!= null)
- {
- for(int i = 0; i<files.length; i++)
- {
- SubPathGenerater.deleteFile( root + SubPathGenerater.getSeperator() + files[i] );
- routeValueBean.removeFile( files[i] );
- System.out.println("......routeFilesUpload.jsp: remove ok: the file size==="+routeValueBean.getRouteFiles().size());
- }
- }
- session.setAttribute( "routeValueBean", routeValueBean );
- }
- %>