This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes File transfering from client machine to Server through FTP. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

File transfering from client machine to Server through FTP.

Gopal krushna Das
Greenhorn

Joined: Jul 03, 2008
Posts: 9
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();
}
}
}
Joanne Neal
Rancher

Joined: Aug 05, 2005
Posts: 3432
    
  12
Don't repost the same question. Your original post was moved from the Advanced forum.


Joanne
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: File transfering from client machine to Server through FTP.
 
Similar Threads
SFTP in Java
Reading log files from various unix servers through Java program on windows
send mail with attachement
File transfering from client machine to Server through FTP.
Password encripting