瀏覽代碼

Added content size to podcast download

tags/2.0.6
Teknikode 3 年之前
父節點
當前提交
679c148029
共有 2 個文件被更改,包括 2 次插入18 次删除
  1. 2
    3
      Teknik/Areas/Podcast/Controllers/PodcastController.cs
  2. 0
    15
      Utilities/Utilities/ResponseHelper.cs

+ 2
- 3
Teknik/Areas/Podcast/Controllers/PodcastController.cs 查看文件

@@ -89,10 +89,9 @@ namespace Teknik.Areas.Podcast.Controllers
if (System.IO.File.Exists(file.Path))
{
FileStream fileStream = new FileStream(file.Path, FileMode.Open, FileAccess.Read);
// Read in the file
//byte[] data = System.IO.File.ReadAllBytes(file.Path);

// Create File
Response.AddHeader("Content-Length", file.ContentLength.ToString());

var cd = new System.Net.Mime.ContentDisposition
{
FileName = file.FileName,

+ 0
- 15
Utilities/Utilities/ResponseHelper.cs 查看文件

@@ -42,21 +42,6 @@ namespace Teknik.Utilities
bytesRemaining -= processedBytes;
}
while (processedBytes > 0 && bytesRemaining > 0);

if (bytesRemaining > 0)
{
// Clear the buffer
Array.Clear(buffer, 0, chunkSize);

// Finalize processing of the cipher
processedBytes = stream.Read(buffer, 0, bytesToRead);
if (processedBytes > 0)
{
// We have bytes, lets write them to the output
response.OutputStream.Write(buffer, 0, processedBytes);
response.Flush();
}
}
}
catch (HttpException httpEx)
{

Loading…
取消
儲存