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 梓楓 閱讀(230) 評論(0)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 池州市| 曲水县| 南岸区| 杭锦旗| 仙游县| 保山市| 衡阳县| 浮梁县| 土默特右旗| 舒兰市| 松潘县| 丰都县| 汕头市| 耒阳市| 益阳市| 始兴县| 谷城县| 巴林左旗| 南皮县| 康平县| 鄯善县| 贵溪市| 崇明县| 西乌| 嘉峪关市| 泰安市| 乌兰察布市| 高密市| 周宁县| 山丹县| 兴安盟| 湄潭县| 晋中市| 南雄市| 兰州市| 柯坪县| 中超| 房产| 元江| 龙井市| 天台县|