일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
- 퇴근버스 조민욱
- 커피레이크
- 영구정지
- 3rd party software
- 김영근 올패스
- #만취
- 보고싶은 내맘
- HttpURLConnection
- 슈퍼스타k 2016
- 사랑 그렇게 보내네 김영근
- 해맑게 웃는 너
- CentOS 6 설치 오류
- 흘러가는대로
- 도전의 기회
- rsnapshot
- i7-8700
- 넬 희망고문
- account ban
- 적절한 타이밍
- 퇴근버스 슈퍼스타K 2016
- 센티멘탈
- 가식의 껍데기
- 흐린날의 낮술
- 짝사랑
- 그게 무슨 의미가 있니
- 지리산 소울 김영근
- 내 자신의 생각
- COC
- nmtui
- 질투
- Today
- Total
끄적거림들...
FTP 파일 업로드하기 (FTPClient) 본문
FTP 로 파일 업로드 하기
String fileName = "uploadFTP.file";
String ftpID = "Id";
String ftpPW = "password";
boolean uploadResult = false;
FTPClient con;
con = new FTPClient();
try {
con.connect("http://ftpLocation", 21);
if(con.login(ftpID, ftpPW)) {
File file = new File("filePath" + File.separator + fileName);
con.enterLocalPassiveMode();
con.setBufferSize(1024*1024);
con.setFileType(FTP.BINARY_FILE_TYPE);
FileInputStream in = new FileInputStream(file);
uploadResult = con.storeFile("/ftp/site/" + fileName, in);
in.close();
if(uploadResult) {
Log.e(TAG, "file upload success");
}
con.logout();
con.disconnect();
file.delete();
}
} catch (Exception e) {
e.printStackTrace();
}
'Androiddd' 카테고리의 다른 글
Android Network 상태 확인하기 (0) | 2016.09.05 |
---|---|
Android DB 사용하기 예제 (0) | 2016.09.05 |
HttpURLConnection 예제 (0) | 2016.09.05 |
HttpClient vs HttpURLConnection (0) | 2016.09.05 |
Android Bluetooth GamePad 연결하기 (0) | 2014.08.14 |