public byte[] DownloadCourseMaterialByMatrialId(int MaterialId) { var mat = CourseMaterialManager.GetMaterialByMaterialId(MaterialId); string filePath = mat.PathOnServer; byte[] fileBytes = System.IO.File.ReadAllBytes(filePath); return(fileBytes); }
public byte[] DownloadAsync(int materialid) { var mat = CourseMaterialManager.GetMaterialByMaterialId(materialid); string filePath = mat.PathOnServer;// Directory.GetCurrentDirectory() + "\\Uploads\\" + url; string fileName = mat.FileName; byte[] fileBytes = System.IO.File.ReadAllBytes(filePath); //var stream = new FileStream(filePath, FileMode.Open); //return File(fileBytes, "application/force-download", fileName); return(fileBytes); }