Is there any other method to perform the file transfer?
The following is my code:-
protected void Button1_Click(object sender, EventArgs e)
{
filePath = FileUpload1.FileName;
try
{
WebClient client = new WebClient();
NetworkCredential nc = new NetworkCredential(uName, password);
Uri addy = new Uri("\\\\192.168.1.3\\upload\\");
client.Credentials = nc;
byte[] arrReturn = client.UploadFile(addy, filePath);
Console.WriteLine(arrReturn.ToString());
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
The following line doesn't execute...
byte[] arrReturn = client.UploadFile(addy, filePath);
This is the error I get:
An exception occurred during a WebClient request
ShilpaPosted Mar 18, 2010, 8:16 AM
ShilpaPosted Mar 18, 2010, 6:28 AM
I used your code. Execution stops at the following line :-
Stream ftpstream = ftp.GetRequestStream();
and this is the error that is displayed:-
"Unable to connect to the remote server"
Amit ChoudharyPosted Mar 17, 2010, 6:44 AM
Try below code for uploading file on ftp server with user credentials:
Please mark as answer if it helps.