Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package mUploader;
- import java.io.File;
- import com.enterprisedt.net.ftp.FileTransferClient;
- /**
- *
- * @author etrosclair
- */
- public class Upload {
- private FileTransferClient ftp;
- private File file;
- private EventListenerImp listener;
- private boolean isDone;
- public Upload(){
- listener = new EventListenerImp();
- isDone = false;
- }
- public void setUp(){
- try{
- ftp = new FileTransferClient();
- ftp.setEventListener(listener);
- ftp.getAdvancedSettings().setTransferBufferSize(500);
- ftp.getAdvancedSettings().setTransferNotifyInterval(10000);
- ftp.setRemoteHost("ftp.jesusthecornerstone.net");
- ftp.setUserName("xxx");
- ftp.setPassword("xxx");
- ftp.connect();
- ftp.changeDirectory("joomla/phocadownload");
- }catch(Exception x){
- x.printStackTrace();
- }
- }
- public void upload(String filename){
- file = new File(filename);
- try{
- ftp.uploadFile(filename,file.getName());
- isDone = true;
- }catch(Exception x){
- x.printStackTrace();
- }
- }
- public EventListenerImp getListener(){
- return listener;
- }
- public boolean isDone(){
- return isDone;
- }
- }
Add Comment
Please, Sign In to add comment