Hi folks,
i am working in C# , i have problem while uploading the file to FTP which has size around 4MB.
The code which comes after the bold area is not executed.. here am interacting with DB for every succeessful upload. But its working well for the file which has small size around 1MB. Please give me a solution asap... My code is as follows.
i am working in C# , i have problem while uploading the file to FTP which has size around 4MB.
The code which comes after the bold area is not executed.. here am interacting with DB for every succeessful upload. But its working well for the file which has small size around 1MB. Please give me a solution asap... My code is as follows.
Code:
string ftpServerIP = rowClient[1].ToString();
string ftpUserID = rowClient[2].ToString();
string Password = rowClient[3].ToString();
//////// ---UpLoading...
FileInfo fileInf = new FileInfo(strfileLocation);
string uri = ftpServerIP + "/" + fileInf.Name;
// Get the object used to communicate with the server.
FtpWebRequest request = (FtpWebRequest)WebRequest.Create(uri);
request.Method = WebRequestMethods.Ftp.UploadFile;
request.Timeout = 3600000; // Equvalent to 1 Hour.
// This example assumes the FTP site uses anonymous logon.
request.Credentials = new NetworkCredential(ftpUserID, Password);
// Copy the contents of the file to the request stream.
StreamReader sourceStream = new StreamReader(fileInf.OpenRead());
byte[] fileContents = Encoding.UTF8.GetBytes(sourceStream.ReadToEnd());
sourceStream.Close();
request.ContentLength = fileContents.Length;
Stream requestStream = request.GetRequestStream();
requestStream.Write(fileContents, 0, fileContents.Length);
requestStream.Close();
FtpWebResponse response = (FtpWebResponse)request.GetResponse();
Console.WriteLine("Upload File Complete, status {0}", response.StatusDescription);
[B] response.Close();[/B]
updateDB(rowClient[0].ToString(), dtime.ToString());
ExecuteNonQuery("update callInfo set status = 'T' where clientId='" + rowClient[0].ToString().Trim() + "' and status ='Q' and date between '" + LastBackUpTime + "' and '" + dtime.ToString() + "'");
Comment