Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

FTP am using Apache commons net  RSS feed

 
Jitendra Nayak
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

this is my code simply upload file to some other windows server

am using apache commons.net

the port available only 21.

through manully i can upload images.

error am getting:
================
0.through manully FTP is working.

1.it is not giving error
2.when i see the path ?/ file is not created.

3. IF i used ASCII format the file is corrupted.
4. if i use BINARY not copying the folder the log file says win server file is created.in the path file is not there.

please can u tell while uploadin gitf images what should i consider.

i need info please?




the following is my code
========================
FTPClient ftp = new FTPClient();
ftp.connect( server );
ftp.setDefaultPort(FTP.DEFAULT_PORT);//ftp.port
int gg = ftp.getDefaultPort();
System.out.println("The port number id ="+gg);

ftp.login( username, password);

System.out.println("Connected to " + server + ".");
int reply = ftp.getReplyCode();
System.out.print(ftp.getReplyString()+"FROM TEXT FTP CODE="+reply);

if (!FTPReply.isPositiveCompletion(reply))
{
ftp.disconnect();
System.err.println("FTP server refused connection.");
System.exit(1);
}

//ftp.setFileType(FTP.BINARY_FILE_TYPE);
ftp.changeWorkingDirectory(desFolder);

InputStream input;

input = new FileInputStream(srcFolder);
System.out.println("The value of = "+input.toString());
ftp.storeFile(desFolder,input);
System.out.println("The value after store file of");
input.close();
 
Jason Liao
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am afraid you might use ftp PUT command to upload files.
 
Jitendra Nayak
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

i checked manully, i can transferr sample tif file using put command.




can u please tell me , how efficently i can transfer images using port 21 or 22.

is there any info i should consider,like FTP proxy and SOCKS proxy.

here when all ports are opened , tested with Apache common .net API.


the same code am using (biany mode and ASCII mode) file not copied in
the folder..
but in windows log file it says the files is copied and not transferred.

please tell me what are info i should consider?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!