Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
24.6k views
in .NET FTP by (800 points)
I'm trying to upload a zip file using the FTPConnection.UploadFile method, and I keep getting a 550 error, and I can't seem to figure out what the problem in. Below is the code that I'm using, and the error that I'm receiving. If anyone has any idea what's going on and how I can deal with it, I would really appreciate it.

The code:

using( FTPConnection cnx = new FTPConnection() )
{
    this.setupConnection( cnx );

    cnx.Connect();
    if( this.config.RequiresLogin )
    {
        cnx.Login();
    }
    cnx.BytesTransferred += new BytesTransferredHandler( FtpBytesTransferred );
    cnx.ChangeWorkingDirectory( this.config.FolderPath );
    cnx.UploadFile( filepath, filepath.Substring( filepath.LastIndexOf( "\\" ) + 1 ) );
    cnx.BytesTransferred -= new BytesTransferredHandler( FtpBytesTransferred );
}

private void setupConnection( FTPConnection cnx )
{
    cnx.ServerAddress = this.config.Host;
    cnx.UserName = this.config.Username;
    cnx.Password = this.config.Password;
    cnx.ConnectMode = this.config.ConnectMode;
    cnx.TransferType = FTPTransferType.BINARY;
}


The error:

EnterpriseDT.Net.Ftp.FTPException: 200702170948.zip: Access is denied. (code=550)
at EnterpriseDT.Net.Ftp.FTPControlSocket.ValidateReply(FTPReply reply, String[] expectedReplyCodes)
at EnterpriseDT.Net.Ftp.FTPClient.InitPut(String remoteFile, Boolean append)
at EnterpriseDT.Net.Ftp.FTPClient.PutBinary(Stream srcStream, String remoteFile, Boolean append)
at EnterpriseDT.Net.Ftp.FTPClient.PutBinary(String localPath, String remoteFile, Boolean append)
at EnterpriseDT.Net.Ftp.FTPClient.Put(String localPath, String remoteFile, Boolean append)
at EnterpriseDT.Net.Ftp.FTPConnection.UploadFile(String localPath, String remoteFile, Boolean append)
at EnterpriseDT.Net.Ftp.FTPConnection.UploadFile(String localPath, String remoteFile)
at BackBurner.Service.FtpClient.UploadFile(String filepath) in C:\MyDir\Visual Studio 2005\Projects\MyApp\MyApp.Service\FtpClient.cs:line 108
at MyApp.Service.Backup.ExportToFTP() in C:\MyDir\Visual Studio 2005\Projects\MyApp\MyApp.Service\Backup.cs:line 346

________________________
// YEX
// John 16:32-33
// http://bob.yexley.net
// http://enjoycharis.com

22 Answers

0 votes
by (162k points)
Are you sure both clients are in exactly the same directories? I can't tell as I think you may have edited the result of PWD.
0 votes
by (800 points)
I just got a little bit nauseous when I read your most recent reply. And, I feel the need to beg your forgiveness for the time you've wasted in helping me get this figured out. You were right. I wasn't using the right path value in my application. I was forgetting to prefix the path with my virtual directory name. When you asked that last question, I went back and compared the two logs, and discovered that you were correct...the path that SmartFTP was using had my virtual directory name at the beginning, and the path that I had configured in my application didn't have it. So essentially, it was trying to use a directory that wasn't there.

Correct path: /ryexley/Users/ryexley/Backup
INcorrect path: /Users/ryexley/Backup

Once I changed my configuration to use the correct path, it worked fine. Again, I'm very sorry for the confusion, and am extremely grateful for your helping me discover how stupid I am, heh. Thanks very much. I think I'm good to go now.

Categories

...