Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

File transfering from client machine to Server through FTP.

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,
I want to make the password hardcoode in this program. Please help me..


//Gopal Das


import com.jscape.inet.ftp.*;
import java.io.*;
import java.util.Enumeration;

public class FtpMuploadExample extends FtpAdapter {
private String hostname;
private String username;
private String password;

// perform multiple file upload
public void doUpload(String hostname, String username, String password) throws FtpException {
Ftp ftp = new Ftp(hostname,username,password);

//capture Ftp related events
ftp.addFtpListener(this);
ftp.connect();
ftp.setBinary();
ftp.mupload(".*\\MUT*.*");
ftp.disconnect();
}

// captures upload event
public void upload(FtpUploadEvent evt) {
System.out.println("Uploaded file: " + evt.getFilename());
}

// captures connect event
public void connected(FtpConnectedEvent evt) {
System.out.println("Connected to server: " + evt.getHostname());
}

// captures disconnect event
public void disconnected(FtpDisconnectedEvent evt) {
System.out.println("Disconnected from server: " + evt.getHostname());
}


public static void main(String[] args) {
String hostname ;
String username;
String password;
try {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter Ftp hostname : ");
hostname = reader.readLine().trim();
System.out.print("Enter username : ");
username = reader.readLine().trim();
System.out.print("Enter password : ");
password = reader.readLine().trim();
System.out.println("Using upload filter .*\\MUT*.*");
FtpMuploadExample example = new FtpMuploadExample();
example.doUpload(hostname,username,password);
}
catch(Exception e) {
e.printStackTrace();
}
}
}
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Don't repost the same question. Your original post was moved from the Advanced forum.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic