Guest User

Untitled

a guest
Jul 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. FTPClient ftp = new FTPClient();
  2. try {
  3. Log.d(TAG ,"serverURl is "+serverUrl);
  4.  
  5. ftp.connect(serverUrl);
  6.  
  7. if(ftp.login(userName, pass))
  8. {
  9. InputStream input;
  10. input = new FileInputStream(Environment.getExternalStorageDirectory()+"/"+dirname+"/"+fileName);
  11. ftp.setFileType(ftp.BINARY_FILE_TYPE);
  12. ftp.enterLocalPassiveMode();
  13. fileStored =ftp.storeFile("/"+remoteFileName, input);
  14. Log.d(TAG ,"file stored is "+fileStored);
  15.  
  16. input.close();
  17. ftp.logout();
  18. }
  19. ftp.disconnect();
  20. return fileStored;
  21.  
  22. } catch (SocketException e) {
  23. e.printStackTrace();
  24. return false;
  25. } catch (IOException e) {
  26. e.printStackTrace();
  27. return false;
Add Comment
Please, Sign In to add comment