posts - 75,comments - 83,trackbacks - 0
           public static void CopyFile(File in, File out) throws Exception {
                  
          try {
                      FileInputStream fis 
          = new FileInputStream(in);
                      FileOutputStream fos 
          = new FileOutputStream(out);
                      
          byte[] buf = new byte[1024];
                      
          int i = 0;
                      
          while ((i = fis.read(buf)) != -1{
                          fos.write(buf, 
          0, i);
                      }

                      fis.close();
                      fos.close();
                  }
           catch (Exception ex) {
                      ex.printStackTrace();
                  }

              }
           String imgFinallyPath = uploadImgPath + java.io.File.separator +maxNewsId;
                           File allFile 
          = new File(uploadImgPath) ;
                           File imgFinallyFile 
          = new File(imgFinallyPath);
                           File[] arrayFile 
          = allFile.listFiles(); //得到web/adimn_inc_upload_news文件夾下的所有文件
                           long currTime = System.currentTimeMillis();
                          
          if (!imgFinallyFile.exists()) {  //創建以ID為名的文件夾
                                  imgFinallyFile.mkdirs();
                              }

                          
          //對當前目錄下面所有文件進行檢索
                           for(int i=0;i<arrayFile.length;i++){
                               
          if(arrayFile[i].isFile()){
                                  String fileName 
          = arrayFile[i].getName(); 
                               }

                           }
          posted on 2008-01-16 14:15 梓楓 閱讀(228) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 元谋县| 名山县| 桂平市| 南昌市| 柏乡县| 绥化市| 确山县| 茌平县| 清丰县| 新郑市| 正定县| 奇台县| 彭州市| 江都市| 任丘市| 柘城县| 滦南县| 邹城市| 阜平县| 长乐市| 永寿县| 乌拉特后旗| 锡林郭勒盟| 镇雄县| 泽州县| 泰来县| 西林县| 白玉县| 平泉县| 托克托县| 东兰县| 布拖县| 江达县| 富源县| 天水市| 饶平县| 霞浦县| 新乐市| 泸西县| 仙居县| 新和县|