Guest User

Untitled

a guest
Jun 25th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5.  
  6. package mUploader;
  7. import java.io.File;
  8. import com.enterprisedt.net.ftp.FileTransferClient;
  9.  
  10. /**
  11. *
  12. * @author etrosclair
  13. */
  14. public class Upload {
  15.  
  16. private FileTransferClient ftp;
  17. private File file;
  18. private EventListenerImp listener;
  19. private boolean isDone;
  20.  
  21.  
  22. public Upload(){
  23. listener = new EventListenerImp();
  24. isDone = false;
  25.  
  26. }
  27.  
  28.  
  29. public void setUp(){
  30. try{
  31. ftp = new FileTransferClient();
  32. ftp.setEventListener(listener);
  33. ftp.getAdvancedSettings().setTransferBufferSize(500);
  34. ftp.getAdvancedSettings().setTransferNotifyInterval(10000);
  35. ftp.setRemoteHost("ftp.jesusthecornerstone.net");
  36. ftp.setUserName("xxx");
  37. ftp.setPassword("xxx");
  38. ftp.connect();
  39. ftp.changeDirectory("joomla/phocadownload");
  40. }catch(Exception x){
  41. x.printStackTrace();
  42. }
  43. }
  44.  
  45. public void upload(String filename){
  46. file = new File(filename);
  47.  
  48.  
  49. try{
  50. ftp.uploadFile(filename,file.getName());
  51. isDone = true;
  52. }catch(Exception x){
  53. x.printStackTrace();
  54. }
  55.  
  56. }
  57.  
  58.  
  59. public EventListenerImp getListener(){
  60. return listener;
  61. }
  62.  
  63. public boolean isDone(){
  64. return isDone;
  65. }
  66.  
  67.  
  68. }
Add Comment
Please, Sign In to add comment