我使用下面的代碼下載視頻文件在ASP.net MVC,但仍無法下載。無法下載視頻文件在ASP.NET MVC
public FileResult GetFile()
{
string filename = string.Empty;
byte[] file = null;
string path = string.Empty;
filename = "testVideo.mp4";
path = Server.MapPath("location path here");
System.IO.FileInfo fileinfo = new System.IO.FileInfo(path);
file = System.IO.File.ReadAllBytes(path);
return File(file, "content-disposition");
}
雙人間檢查是否有權利閱讀給定的位置。 –
我檢查了這條路徑。我可以播放該文件,但無法下載該視頻。即使使用相同的代碼,我也可以下載.ppt文件。 –
請看我的答案,希望它的mime類型需要添加 –