日期:2014-05-17 浏览次数:21145 次
int UploadNum=0;
Stream dataStream = request.GetRequestStream();
UploadNum = postData.Length / 5000;
System.Threading.Timer FileTm = new System.Threading.Timer(CalculateSpeedTime, null, 0, 1500);
for (int i = 0; i <= UploadNum; i++)
{
if (i == UploadNum)
{
dataStream.Write(postData, i * 5000, postData.Length - i * 5000);
TempDataSize += postData.Length - i * 5000;
}
else
{
dataStream.Write(postData, i * 5000, 5000);//这里会报错
TempDataSize += 5000;
}
setprogressbar(true, (i * 5000.0 / postData.Length) * 100.0, UploadSpeed);
}
dataStream.Close();