Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
7.3k views
in Java FTP by (260 points)
Hi All,

I am using the trial version of the enterprisedt, edtftpj-pro.jar.

I am trying to test your UploadDownloadFiles java file.

I am trying to upload a file in the server, which is located in my
linux server at /var/ftp/pub/xyz/abc/test.wav.

I am using below code, but I could not upload a file.

FTPClient ftp = new FTPClient();
ftp.setRemoteHost(host);
ftp.connect();
ftp.login(username, password);
ftp.chdir("/var/ftp/pub/abc/xyz/");
ftp.setType(FTPTransferType.BINARY);

ftp.put(new FileInputStream(new File("c:/temp/test.wav")), "test1.wav");

I am getting this exception.

com.enterprisedt.net.ftp.FTPException: Could not create file.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.initPut(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.A(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.put(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.put(Unknown Source)



can some one point me to sample code, which has exact filename
and its location formats specificed, or else can you point out where I am wrong.

Any help is highly Appreciated.

Thanks & Regards,
Venkat.

4 Answers

0 votes
by (260 points)
Hi All,

I am using the trial version of the enterprisedt, edtftpj-pro.jar.

I am trying to test your UploadDownloadFiles java file.

I am trying to upload a file in the server, which is located in my
local system at c:/temp/test.wav.

I am using below code, but I could not upload a file.

FTPClient ftp = new FTPClient();
ftp.setRemoteHost(host);
ftp.connect();
ftp.login(username, password);
ftp.chdir("/var/ftp/pub/abc/xyz/");
ftp.setType(FTPTransferType.BINARY);

ftp.get("c:/temp/test.wav", "test1.wav");

I am getting this exception.

com.enterprisedt.net.ftp.FTPException: Could not create file.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.initPut(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.A(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.put(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.put(Unknown Source)



can some one point me to sample code, which has exact filename
and its location formats specificed, or else can you point out where I am wrong.

Any help is highly Appreciated.

Thanks & Regards,
Venkat.
0 votes
by (162k points)
Please post the log file (see the Dev Guide for details).
0 votes
by (260 points)
Hi,

Thanks for your quick reply.

Here is my log details.

INFO [FTPControlSocket] 3 Jul 2008 10:51:24.500 : Expected reply codes = [125,150,151,350]
ERROR [FTPClient] 3 Jul 2008 10:51:24.500 : Caught and rethrowing exception in initPut() : Could not create file.
com.enterprisedt.net.ftp.FTPException: Could not create file.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.initPut(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.A(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.put(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.put(Unknown Source)
at com.pbx.remoteasterisk.UploadDownloadFiles.main(UploadDownloadFiles.java:74)


com.enterprisedt.net.ftp.FTPException: Could not create file.
at com.enterprisedt.net.ftp.FTPControlSocket.validateReply(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.initPut(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.A(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.put(Unknown Source)
at com.enterprisedt.net.ftp.FTPClient.put(Unknown Source)
at com.pbx.remoteasterisk.UploadDownloadFiles.main(UploadDownloadFiles.java:74)



Any help is highly Appreciated.

Thanks & Regards,
Venkat.
0 votes
by (162k points)
Please set the level of logging to ALL.

It looks like your user does not have permission to create this file - the server is sending back an error message.

Can you perform this operation in another client?

Categories

...