-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFtpClient.java
More file actions
63 lines (48 loc) · 1.26 KB
/
FtpClient.java
File metadata and controls
63 lines (48 loc) · 1.26 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.mobasherin.porsoon.handler;
import android.util.Log;
import org.jibble.simpleftp.SimpleFTP;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
/**
* Created by Alireza Nazari on 3/13/17.
*/
public class FtpClient {
String url , user , pass , data , directoty;
File file;
int flag ;
public FtpClient(String tmpUrl , String tmpUser , String tmpPass , String tmpDirectory ,String filePath , File tmpFile) {
url = tmpUrl;
user= tmpUser;
pass= tmpPass;
data= filePath;
directoty = tmpDirectory;
file =tmpFile;
}
public void upload(){
try {
SimpleFTP ftp = new SimpleFTP();
ftp.connect(url , 21 , user , pass);
ftp.bin();
ftp.cwd(directoty);
ftp.stor(file);
ftp.disconnect();
flag = 1;
} catch (IOException e) {
flag = 0;
e.printStackTrace();
}
}
public boolean getResult(){
try {
if (flag == 0)
return false;
else if (flag == 1)
return true;
else
return false;
}catch (Exception e){
return false;
}
}
}