2012-07-15 3 views
0
나는이 방법으로 보관함에 파일을 업로드하고

:파일이 dropbox에 이미있는 경우 파일을 덮어 쓰는 방법은 무엇입니까?

public void upload() { 

     FileInputStream inputStream = null; 
     try { 
      File file = new File(Environment.getExternalStorageDirectory() 
        .toString() + "/write.txt"); 
      inputStream = new FileInputStream(file); 
      Entry newEntry = mDBApi.putFile("/write.txt", inputStream, 
        file.length(), null, null); 
      Log.i("DbExampleLog", "The uploaded file's rev is: " + newEntry.rev); 
     } catch (DropboxUnlinkedException e) { 
      // User has unlinked, ask them to link again here. 
      Log.e("DbExampleLog", "User has unlinked."); 
     } catch (DropboxException e) { 
      Log.e("DbExampleLog", "Something went wrong while uploading."); 
     } catch (FileNotFoundException e) { 
      Log.e("DbExampleLog", "File not found."); 
     } finally { 
      if (inputStream != null) { 
       try { 
        inputStream.close(); 
       } catch (IOException e) { 
       } 
      } 
     } 

    } 

하지만이 파일은 다음 파일 쓰기로 이름이 변경 얻을 폴더에 존재하는 경우 이미 (1) 을 .txt를 사용하지만 원하는 이미 파일 경우 보관 용 계정 공유 폴더에 존재하면 대체됩니다. 지금 어떻게해야합니까?

+0

mDBApi.putFilemDBApi.putFileOverwrite 사용할 수있는 유'file.exists()를 시도했던'기능 – reiley

+0

아니,하지만이 후 작동하는지 내가 이전을 덮어 어떻게해야합니까? – Reyjohn

+0

아무도 도와 줄 수 있습니까? – Reyjohn

답변

1

대신

관련 문제