• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with FTP

 
Knob Khera
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
posted April 12, 2006 04:40 AM Profile for K PT Email K PT Send New Private Message Edit/Delete Post Reply With Quote I'm using Apache commons.net API for FTP file Upload\Download.
The program(given below) is working fine(i.e uploading\Downloading)for ENGLISH Filename.But while Uploading/Downloading Japanese Filename the file name get junk..(i.e ???.txt)


Please suggest some solution::

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.SocketException;

import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient;

public class FTPPutUpLoad {

public static void main(String[] args) throws IOException {
FTPClient ftp = new FTPClient();
try {
ftp.connect("myjavaserver.com");
} catch (SocketException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
ftp.login("abcd","abcd");
ftp.setFileType(FTP.ASCII_FILE_TYPE);

ftp.enterLocalActiveMode();
ftp.changeWorkingDirectory("dsr");

FileInputStream st = new FileInputStream(new File("D:\\Bugs\\Dem\\さんは書きま.txt")); //file path

File st2=new File("NOOP.txt");
String aa=st2.toString();
System.out.println(aa);

if(ftp.storeFile(aa, st)){//ftp.storeFile(aa,st)

ftp.disconnect();
st.close();

}




}
}


Thanks
bugs
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear "Knob",

Welcome to JavaRanch!

On your way in, you may have missed the JavaRanch Naming Policy. Please take a moment to edit your name to use real (or at least real-looking) first and last name.

Thank you for your prompt attention, and enjoy the ranch!

Layne
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!