project_create_upload.jsp
上传用户:guhaomin
上传日期:2007-06-10
资源大小:23203k
文件大小:4k
源码类别:

电子政务应用

开发平台:

Java

  1. <%       
  2.        String root = ConfigParaLoader.getParameter("rootUrl");       
  3.        
  4.    if( request.getParameter("type") !=null && Integer.parseInt( request.getParameter("type") ) == 1 ) //上传文件
  5.        {         
  6.            String attachURL = ConfigParaLoader.getParameter("workflowAttachmentUrl");
  7.            attachURL += SubPathGenerater.getSeperator() + SubPathGenerater.getSubPath( root + SubPathGenerater.getSeperator() + attachURL);
  8.            
  9.            //上传文件                   
  10.            // Initialization
  11.            mySmartUpload.initialize( pageContext );           
  12.        mySmartUpload.setTotalMaxFileSize( Integer.parseInt( ConfigParaLoader.getParameter("attachmentSize") ) );
  13.        mySmartUpload.setDeniedFilesList("exe,bat,jsp");
  14.        // Upload
  15.        mySmartUpload.upload();
  16.        mySmartUpload.save( root + SubPathGenerater.getSeperator() + attachURL  );
  17.               
  18.        //保存已有信息
  19.        if( mySmartUpload.getRequest().getParameter("title") != null )
  20.            pvb.setTitle( mySmartUpload.getRequest().getParameter("title") );
  21.        if( mySmartUpload.getRequest().getParameter("planBeginDateS") != null && !mySmartUpload.getRequest().getParameter("planBeginDateS").equals("") )           
  22.            pvb.setPlanBeginDateS( mySmartUpload.getRequest().getParameter("planBeginDateS") );
  23.        if( mySmartUpload.getRequest().getParameter("planEndDateS") != null && !mySmartUpload.getRequest().getParameter("planEndDateS").equals("") )             
  24.            pvb.setPlanEndDateS( mySmartUpload.getRequest().getParameter("planEndDateS") );           
  25.        if( mySmartUpload.getRequest().getParameter("description") != null )             
  26.            pvb.setDescription( mySmartUpload.getRequest().getParameter("description") );   
  27.        if( mySmartUpload.getRequest().getParameter("templateId") != null )
  28.            pvb.setTemplateId( Integer.valueOf( mySmartUpload.getRequest().getParameter("templateId") ).intValue() );         
  29.        if( mySmartUpload.getRequest().getParameterValues("stepNos") != null )
  30.            pvb.setStepNos( mySmartUpload.getRequest().getParameterValues("stepNos") );         
  31.                           
  32.            Collection c = pvb.getFiles();       
  33.            for(int i=0;i<mySmartUpload.getFiles().getCount();i++)
  34.            {
  35.                com.vnex.intranet.upload.File myFile = mySmartUpload.getFiles().getFile(i);
  36.                if (!myFile.isMissing())   
  37.                {
  38.                    WorkflowFileValueBean wf = new WorkflowFileValueBean();
  39.                    wf.setName( myFile.getFileName() ); 
  40.                    wf.setTitle( attachURL + "/" + myFile.getFileName() ); 
  41.                    wf.setDescription( myFile.getFileName() ); 
  42.                    c.add(wf);              
  43.                }                            
  44.            }         
  45.            pvb.setFiles(c);            
  46.   }
  47.   
  48.       if( request.getParameter("type") !=null && Integer.parseInt( request.getParameter("type") ) == 2 ) //删除文件
  49.       {                
  50.        //保存已有信息
  51.        if( request.getParameter("title") != null )
  52.            pvb.setTitle( request.getParameter("title") );
  53.        if( request.getParameter("planBeginDateS") != null && !request.getParameter("planBeginDateS").equals("") )           
  54.            pvb.setPlanBeginDateS( request.getParameter("planBeginDateS") );
  55.        if( request.getParameter("planEndDateS") != null && !request.getParameter("planEndDateS").equals("") )             
  56.            pvb.setPlanEndDateS( request.getParameter("planEndDateS") );           
  57.        if( request.getParameter("description") != null )             
  58.            pvb.setDescription( request.getParameter("description") );   
  59.        if( request.getParameter("templateId") != null )
  60.            pvb.setTemplateId( Integer.valueOf( request.getParameter("templateId") ).intValue() ); 
  61.        if( request.getParameterValues("stepNos") != null )
  62.            pvb.setStepNos( request.getParameterValues("stepNos") );                
  63.          
  64.            String files[] = request.getParameterValues("attachments");
  65.             
  66.            if(files!= null)
  67.            {              
  68.                for(int i = 0; i<files.length; i++)
  69.                {
  70.                     SubPathGenerater.deleteFile( root + SubPathGenerater.getSeperator() + files[i] );  
  71.                     pvb.removeFile(  files[i] );        
  72.                }     
  73.            }            
  74.      }
  75. %>