P
Piotrekk
Hi
Probability of this phenomena is like 1/200.
The only code where I am dealing with file is the following:
using (FileStream fs = new FileStream(this.FilePath,
FileMode.Open,FileAccess.Read))
{
try
{
// This is web service call to check if i user has
permissions to upload file
myObj.BeforeUpload(this.FileName,
this.ServerPath);
while ((this.Offset < this.FileSize) && !
this.Stop)
{
fs.Seek(Offset, SeekOrigin.Begin);
buffer = new byte[32 * 1024];
BytesRead = fs.Read(buffer, 0, buffer.Length);
byte[] buff = new byte[BytesRead];
Copy(buffer, 0, buff, 0, BytesRead);
myObj.UploadChunk(this.FileName,
this.ServerPath, this.Offset, buff);
this.Offset += buff.Length;
//report progress to backgroundworker
bgw.ReportProgress((int)(((decimal)Offset /
(decimal)FileSize) * 100));
}
}
finally
{
fs.Close();
}
}
Question is. Why sometimes such an operation leaves my file empty.
This is upload file code. I have left every line unchanged. If you
have more skills than me try to explain this phenomena because I have
no more ideas.
Regards
ps I would be really grateful for an explanation )
Piotr Kolodziej
Probability of this phenomena is like 1/200.
The only code where I am dealing with file is the following:
using (FileStream fs = new FileStream(this.FilePath,
FileMode.Open,FileAccess.Read))
{
try
{
// This is web service call to check if i user has
permissions to upload file
myObj.BeforeUpload(this.FileName,
this.ServerPath);
while ((this.Offset < this.FileSize) && !
this.Stop)
{
fs.Seek(Offset, SeekOrigin.Begin);
buffer = new byte[32 * 1024];
BytesRead = fs.Read(buffer, 0, buffer.Length);
byte[] buff = new byte[BytesRead];
Copy(buffer, 0, buff, 0, BytesRead);
myObj.UploadChunk(this.FileName,
this.ServerPath, this.Offset, buff);
this.Offset += buff.Length;
//report progress to backgroundworker
bgw.ReportProgress((int)(((decimal)Offset /
(decimal)FileSize) * 100));
}
}
finally
{
fs.Close();
}
}
Question is. Why sometimes such an operation leaves my file empty.
This is upload file code. I have left every line unchanged. If you
have more skills than me try to explain this phenomena because I have
no more ideas.
Regards
ps I would be really grateful for an explanation )
Piotr Kolodziej