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)  編輯  收藏

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


          網站導航:
           
          主站蜘蛛池模板: 固始县| 库伦旗| 井冈山市| 辽中县| 涞水县| 始兴县| 女性| 巴林左旗| 额敏县| 津南区| 潮州市| 屏山县| 潼关县| 宁陕县| 海南省| 荥经县| 孟州市| 云安县| 保康县| 泰州市| 锡林郭勒盟| 胶州市| 陈巴尔虎旗| 晋州市| 大姚县| 象山县| 喀喇沁旗| 渭南市| 祁门县| 班玛县| 辽宁省| 汝城县| 高陵县| 连南| 宝应县| 潞城市| 长岭县| 奈曼旗| 乡宁县| 曲周县| 沙河市|