Bookmark Topic Watch Topic
  • New Topic

Problem in FTP

 
Knob Khera
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello "K PT"-

Welcome to JavaRanch.

On your way in you may have missed that JavaRanch has a policy on display names, and yours does not comply with it - please adjust it accordingly, which you can do right here. Thanks for your prompt attention to this matter.

Also, please do not post questions to more than one forum, like you have done here. Let's continue the discussion in the other thread, where it belongs.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
Closing this copy of the thread...
 
    Bookmark Topic Watch Topic
  • New Topic