FTP upload fails

G

Guest

Hi,, can anyone help me???

I have made an FTP-app like the code on:
http://support.microsoft.com/default.aspx?scid=kb;en-us;832679

But i can't upload a file??? I recives an error when the app is trying to
create the socet for upload?? .... It works on local machine, but not to the
remote server im trying to connect to??

But creating a Folder with "ff.CreateDirectory("FTPFOLDERNEW")"
(MKD-command), works fine on the remote server.. So why can't I allso upload
a file??

Thansk
 
G

Guest

Henrick,
I used similar code to create an FTP class but there were
a few problems such as connection timeout parameter cannot be set, it takes
the default value which is around 45 secs if Im not mistaken & this causes a
huge delay in case an FTP Server is not available. Someone out here suggested
using Indy. Sockets and it works very well for me. You can download it at
http://www.indyproject.org.
Below is the code snippet to upload files.

protected void PerformFTP()
{
try
{
client=new Indy.Sockets.FTP();
client.ConnectTimeout=System.Convert.ToInt32(base.ConnectTimeout);
client.TransferTimeout= System.Convert.ToInt32(base.ResponseTimeout);
client.Username =base.UserID;
client.Password=base.Password;
client.Connect(base.IPAddress, 21);
client.Put(base.LocalDirectory + base.UploadFileName, base.UploadFileName,
false);
client.Disconnect();
}
catch(Exception e)
{
base.LogTransaction(base.LogDirectory,e.StackTrace + " " +
e.InnerException );
throw new Exception("Error occured in Clients.FTPIndy.PerformFTP: "+
e.Message + " " + e.InnerException + " " + e.StackTrace );
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top