夢幻之旅

          DEBUG - 天道酬勤

             :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
            671 隨筆 :: 6 文章 :: 256 評論 :: 0 Trackbacks
          /** 上傳文件 */
              
          private File upload;
              
              
          /** 上傳類型 */
              
          private String uploadContentType;
              
              
          /** 上傳文件名 */
              
          private String uploadFileName;
              
              
          /** 文件上傳服務 */
              
          private ImportFileService importFileService;
              
              
          /**
               * <ul>
               * <li>Description:[上傳文件]</li>
               * <li>Created by [Huyvanpull] [2010-8-2]</li>
               * <li>Midified by [修改人] [修改時間]</li>
               * </ul>
               * 
               * 
          @return
               
          */

              
          public String uploadFile()
              
          {
                  UploadFileRes res 
          = null;
                  
                  
          try
                  
          {
                      
          // 保存文件路徑
                      String filePath = ServletActionContext.getServletContext()
                              .getRealPath(
          "/importmgr/tempUploadFileDir");
                      filePath 
          += "\\" + uploadFileName;
                      
                      UploadFileReq req 
          = new UploadFileReq();
                      req.setUploadFile(upload);
                      req.setServerFilePath(filePath);
                      req.setUploadFileName(uploadFileName);
                      
                      res 
          = this.getImportFileService().uploadFile(req);
                  }

                  
          catch (Exception ex)
                  
          {
                      ex.printStackTrace();
                      res 
          = new UploadFileRes();
                      res.setResCode(
          -1);
                      res.setMessage(
          "上傳文件失敗");
                  }

                  
                  
          this.outXMLString(res.toXML());
                  
                  
          return null;
              }
          posted on 2010-08-02 18:24 HUIKK 閱讀(220) 評論(0)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 绍兴市| 于都县| 亚东县| 柏乡县| 武鸣县| 开封县| 西丰县| 正安县| 聂拉木县| 临澧县| 凤城市| 弋阳县| 五华县| 峨山| 望都县| 天水市| 柘荣县| 遂溪县| 崇信县| 枣强县| 万源市| 阳东县| 达日县| 昭通市| 昌乐县| 友谊县| 革吉县| 应城市| 衡阳市| 湖州市| 芦山县| 普陀区| 买车| 平武县| 静乐县| 龙山县| 肥乡县| 松原市| 金溪县| 古蔺县| 辰溪县|