Discuss (FTP), (FTP on .NET CF) and (FTPS, SFTP and SCP).
no avatar
User

Robotronic

Posts

2

Joined

Mon May 09, 2005 10:10 am

Can anyone tell me why I am unable to put a file.

by Robotronic » Mon May 09, 2005 10:20 am

Ok. let me first say I? a newbie to this FTP component, but I?m an experienced developer, hence the frustration.

I'm trying to perform the most basic piece of functionality, which is to upload a file.

I have eliminated the host, server and password for the following reasons -
1) No exceptions are raised
2) I can successfully browse the files
3)Also using Windows explorer I can ftp the files, so I?m confident that the host , server name and password are correct.


Example code fragment -
?..
FTPFile[] dir;
dir = ftp.DirDetails(".");


This works just fine and lists all the folders and files in the root folder.


So why can?t I upload a file, and why are no exceptions raised to tell me what I?m doing wrong?

The code looks like this -

try
{
FTPClient ftp;

ftp = new FTPClient(in_strHost);

ftp.Login(in_strUserName, in_strPassword);

// set up passive ASCII transfers
ftp.ConnectMode = FTPConnectMode.PASV;
ftp.TransferType = FTPTransferType.ASCII;

// copy file to server
ftp.ChDir(".");
strSourceFile = @?c:\temp\test.txt?;
ftp.Put(strSourceFile, "test.txt");


ftp.Quit();
}

catch (Exception e)
{
string strError;
strError = e.Message;

MessageBox.Show( strError);
}




My environment is
Visual Studio.NET 2003
Microsoft Wndows 2000 Professional
Host service provider: www.discountasp.net
no avatar
User

Robotronic

Posts

2

Joined

Mon May 09, 2005 10:10 am

by Robotronic » Mon May 09, 2005 1:59 pm

My bad. I believed my lying eyes and made an incorrect assumption.

Windows explorer does not display the freshly posted file, even if you re-click the folder I actually discovered that the put works after all, but I could only see the file afer closing down windows explorer and re-establishing a ftp connection.

Who is online

Users browsing this forum: No registered users and 8 guests

Powered by phpBB ® | phpBB3 Style by KomiDesign