0 votes
by (320 points)

Hello Team,

We are getting the below exception while uploading a file using PutFile method.

===========Error Information=============================
15:26:18.227 Info Info: Connecting to ftp2.ftccc.net:21 using Ftp 4.0.4546.0.
15:26:18.229 Info Info: Using proxy none.
15:26:18.259 Info Response: 220 Titan FTP Server 7.13.903 Ready.
15:26:18.262 Info Command: USER aimsupload@ftccc.net
15:26:18.297 Info Response: 331 User name okay, need password.
15:26:18.299 Info Command: PASS *********
15:26:18.379 Info Response: 230-Welcome aimsupload@ftccc.net from 191.236.110.177. You are now logged in to the server.
15:26:18.381 Info Response: 230 User logged in, proceed.
15:26:18.384 Info Command: FEAT
15:26:18.396 Info Response: 211-Extensions Supported
15:26:18.399 Info Response: COMB
15:26:18.401 Info Response: MLST type;size;modify;create;perm*;
15:26:18.404 Info Response: SIZE
15:26:18.407 Info Response: MDTM
15:26:18.409 Info Response: MFMT
15:26:18.411 Info Response: MFCT
15:26:18.414 Info Response: EPRT
15:26:18.417 Info Response: EPSV
15:26:18.419 Info Response: XCRC
15:26:18.421 Info Response: REST STREAM
15:26:18.423 Info Response: DQTA
15:26:18.425 Info Response: 211 End
15:26:18.429 Info Command: TYPE A
15:26:18.442 Info Response: 200 Type set to A.
15:26:18.444 Info Command: PASV
15:26:18.461 Info Response: 227 Entering Passive Mode (12,53,113,138,18,171).
15:26:18.477 Info Command: STOR //SALCINV_20150915152617.AMI
15:26:18.492 Info Response: 550 Requested action not taken, file not found or no access.
***15:26:18.494 Error Info: Rebex.Net.FtpException: Requested action not taken, file not found or no access (550).
at Rebex.Net.Ftp.2aYAeNZ(String , Boolean , OTxlj , Int64 , String , String , Int64 , FtpTransferState )
at Rebex.Net.Ftp.y7ABW(String , String , Stream , Int64 , Int64 , 27NpLhZ )***

=====================================================================

In this FTP, we don't have an access to get the list of files/folders for this user.
With out verifying/getting the list, just we need to upload a file in ftp's root folder. Please help me how I can achieve this. We can put the file using Windows File Explorer.
Please help me to resolve this error.

Thanks & Regards
Naga Suresh D

Applies to: Rebex FTP/SSL

2 Answers

0 votes
by (58.9k points)
edited by

Hello,

the Ftp.PutFile method is suitable for this purpose. it does not perform any listing prior to the file upload.

Are you able to upload the file to the FTP server root with the short code below?

Ftp client = new Ftp();
ftp.LogWriter = new Rebex.FileLogWriter(@"C:\logs\ftp-log.txt", Rebex.LogLevel.Debug);
client.Connect("ftp2.ftccc.net");
client.Login("ftp2.ftccc.net", "your-password");

// upload the local file to FTP server's root
client.PutFile(@"C:\data\SALCINV_20150915152617.AMI", "/SALCINV_20150915152617.AMI");
client.Disconnect();

Please give it a try and let me know whether it works.

by (320 points)
Hello,

I have tried with the same code which you provided. Issue is still reproducing. See below error log.

================================================================

2015-09-18 16:00:31.796 Opening log file.
2015-09-18 16:00:31.812 INFO Ftp(5)[1] Info: Connecting to ftp2.ftccc.net:21 using Ftp 4.0.4546.0.
2015-09-18 16:00:31.812 INFO Ftp(5)[1] Info: Using proxy none.
2015-09-18 16:00:31.855 DEBUG Ftp(5)[1] Info: Connection succeeded.
2015-09-18 16:00:31.871 INFO Ftp(5)[1] Response: 220 Titan FTP Server 7.13.903 Ready.
2015-09-18 16:00:31.879 INFO Ftp(5)[1] Command: USER aimsupload@ftccc.net
2015-09-18 16:00:31.915 INFO Ftp(5)[1] Response: 331 User name okay, need password.
2015-09-18 16:00:31.916 INFO Ftp(5)[1] Command: PASS *********
2015-09-18 16:00:31.996 INFO Ftp(5)[1] Response: 230-Welcome aimsupload@ftccc.net from 191.236.110.177. You are now logged in to the server.
2015-09-18 16:00:31.996 INFO Ftp(5)[1] Response: 230 User logged in, proceed.
2015-09-18 16:00:31.998 INFO Ftp(5)[1] Command: FEAT
2015-09-18 16:00:32.010 INFO Ftp(5)[1] Response: 211-Extensions Supported
2015-09-18 16:00:32.010 INFO Ftp(5)[1] Response:  COMB
2015-09-18 16:00:32.011 INFO Ftp(5)[1] Response:  MLST type*;size*;modify*;create*;perm*;
2015-09-18 16:00:32.011 INFO Ftp(5)[1] Response:  SIZE
2015-09-18 16:00:32.011 INFO Ftp(5)[1] Response:  MDTM
2015-09-18 16:00:32.011 INFO Ftp(5)[1] Response:  MFMT
2015-09-18 16:00:32.011 INFO Ftp(5)[1] Response:  MFCT
2015-09-18 16:00:32.011 INFO Ftp(5)[1] Response:  EPRT
2015-09-18 16:00:32.011 INFO Ftp(5)[1] Response:  EPSV
2015-09-18 16:00:32.011 INFO Ftp(5)[1] Response:  XCRC
2015-09-18 16:00:32.011 INFO Ftp(5)[1] Response:  REST STREAM
2015-09-18 16:00:32.011 INFO Ftp(5)[1] Response:  DQTA
2015-09-18 16:00:32.011 INFO Ftp(5)[1] Response: 211 End
2015-09-18 16:00:34.149 DEBUG Ftp(5)[1] Info: Starting data transfer.
2015-09-18 16:00:34.150 INFO Ftp(5)[1] Command: TYPE I
2015-09-18 16:00:34.164 INFO Ftp(5)[1] Response: 200 Type set to I.
2015-09-18 16:00:34.166 INFO Ftp(5)[1] Command: PASV
2015-09-18 16:00:34.182 INFO Ftp(5)[1] Response: 227 Entering Passive Mode (12,53,113,138,12,176).
2015-09-18 16:00:34.186 DEBUG Ftp(5)[1] Info: Establishing data connection to 12.53.113.138:3248.
2015-09-18 16:00:34.199 INFO Ftp(5)[1] Command: STOR /test123.txt
2015-09-18 16:00:34.215 INFO Ftp(5)[1] Response: 550 Requested action not taken, file not found or no access.
2015-09-18 16:00:34.217 DEBUG Ftp(5)[1] Info: Error while starting data transfer: Rebex.Net.FtpException: Requested action not taken, file not found or no access (550).
   at Rebex.Net.Ftp.2aYAeNZ(String , Boolean , OTxlj , Int64 , String , String , Int64 , FtpTransferState )
2015-09-18 16:00:34.218 DEBUG Ftp(5)[1] Info: Error while initializing data connection.
2015-09-18 16:00:34.219 ERROR Ftp(5)[1] Info: Rebex.Net.FtpException: Requested action not taken, file not found or no access (550).
   at Rebex.Net.Ftp.2aYAeNZ(String , Boolean , OTxlj , Int64 , String , String , Int64 , FtpTransferState )
   at Rebex.Net.Ftp.y7ABW(String , String , Stream , Int64 , Int64 , 27NpLhZ )

================================================================

Now we are able to upload the file from both FileZilla and Windows File Explorer.
We are having this issue with only Rebex PutFile method.

Please help me to resolve this error.
0 votes
by (72.7k points)
edited by

This is really strange error message. Perhaps the server doesn't allow write access to the FTP root folder, or it doesn't like absolute paths. Can you please try the following code?

The code will upload the file into current working directory. You can determine what is your current working directory using the client.GetCurrentDirectory() method. To change working directory use the client.ChangeDirectory() method.

If it still doesn't work. Please send us FileZilla log for comparison.

Ftp client = new Ftp();
client.LogWriter = new Rebex.FileLogWriter(@"C:\logs\ftp-log.txt", Rebex.LogLevel.Debug);
client.Connect("ftp2.ftccc.net");
client.Login("user-name", "user-password");

// change working directory if needed
//client.ChangeDirectory("/");

// upload the local file to current working directory 
// at the FTP server
client.PutFile(@"C:\data\test123.txt", "test123.txt");
client.Disconnect();
by (320 points)
May I know how the FileZilla and Windows File Explorer are handling this?

If we know the generic fix, it is very useful for other FTPs.
by (58.9k points)
edited by
I don't know what you mean by generic fix... If your requirement is upload to home directory, I already provided a simple code to achieve this with Rebex which will work with any FTP server.  If apart from this, you will also need to upload to some other directories (e.g. to "non-home directories") then you have to know what is the target directory for each FTP server. And you will have to have a parameter / config value / GUI pick in your program that you will use to determine where exactly you need to upload.

For sample implementation of a GUI FTP client, please check our Ftp WinformClient sample (http://www.rebex.net/sample/ftp-winform-client-classic/). The sample source code comes as a part of your Rebex FTP/SSL package.

And by the way, could you please share your order ID or the email that you used to buy your Rebex FTP license? Unfortunatelly, I was unable to find your order in our system.
by (320 points)
Thank you.

We have a different email id which has Rebex license. Unfortunately we missed the password. So we created an anonymous user in Rebex and created this ticket.
by (58.9k points)
Ok, no problem, but what is the registered email? You can send it to us privately to support@rebex.net and I will associate the forum account with your license then. Thank you.
by (58.9k points)
You can reset your account password at https://www.rebex.net/userLostPassword.aspx
...