// 儲存位元組
using (FileStream fs = new FileStream(Path.Combine(path, fileName), FileMode.Create))
{
while (uploadInfo.UploadedLength < uploadInfo.ContentLength)
{
//從輸入流放進緩衝區
int bytes = this.fileUpload.PostedFile.InputStream.Read(buffer, 0, bufferSize);
// 位元組寫入檔案流
fs.Write(buffer, 0, bytes);
// 更新大小
uploadInfo.UploadedLength += bytes;
// 執行緒睡眠 上傳就更慢 這樣就可以看到進度條了
System.Threading.Thread.Sleep(100);
}
}