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