Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
2.5k views
in .NET FTP by (220 points)
Hi all,

I'm getting a strange exception when I try to simply put a file a server. Indeed, I've made a simple test ( see below ), and when I call the "put" function I get :
Object reference not set to an instance of an object." System.Exception {System.NullReferenceException}

Some remarks :
_ The local file "E:\Test.zip" is existing
_ I've got all the authorization on the ftp server to put the file

Here is my code :

string sFilePath = "E:\\Test.zip";
string sRemoteFileName = "Test.zip";

FTPClient ftp = new FTPClient();
FileInfo fi = new FileInfo(sFilePath);
FileStream fs = fi.OpenRead();
try
{
ftp.Put(fs, sRemoteFileName, false);
}
catch
{
// I get here the Exception
}


If you have got an idea about the reason I get an NullReferenceException ....

Thanks a lot for your help.
________
Zx14 vs hayabusa

2 Answers

0 votes
by (220 points)
I forgot the line code doing the connection to the server, but to be complete:
_ My ftp connection is valid ( the object is well composed )
_ The FileStream is also well womposed and valid.
_ If I tried to put the file with FileZilla for example then it works fine

Thanks
________
Mercedes-Benz W124
0 votes
by (220 points)
I have found my problem, it was a problem with the code in my callback TransferStartedHandler.

I apologize for this... :oops:
________
Dc Medical Marijuana

Categories

...