Author: xmen | Posted on: 7/5/2009 8:33:36 AM | Views : 271

 I usually need to upload file on my server from another server and to do that I've wrote a code, it works good but it never show progress or something like that. I tried to use callback but it didnt work too. Here is the code


  WebRequest requestFile = WebRequest.Create(downloadLink.Text);
  WebResponse responseFile = requestFile.GetResponse();

  Stream stream = responseFile.GetResponseStream();
  try { TotalBytes = stream.Length; }
  catch { TotalBytes = -1; }
  FileStream fs = new FileStream(destFilePath, FileMode.Create);
  const int buffersize = 1024 * 16;
  byte[] buffer = new byte[buffersize];

  int count = stream.Read(buffer, 0, buffersize);
  ReadedBytes += count;
   
  while (count > 0)
  {
  fs.Write(bu ...

Go to the complete details ...