場景,我有一個網頁,當用戶打開它時,他們填寫表格并可以下載 T&C pdf 檔案。
這個怎么做?
這是我的控制器代碼:
public FileResult DownloadFile()
{
byte[] fileBytes = System.IO.File.ReadAllBytes(@"\\server\wwwroot\testapp\Files\Terms and Conditions.pdf");
string fileName = "Terms and Conditions.pdf";
return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
}
在下載鏈接的索引 (.cshtml) 頁面上做什么?
uj5u.com熱心網友回復:
“Terms and Conditions.pdf”檔案是否會根據用戶填寫表格時捕獲的資料發生變化?如果沒有,你能不能簡單地使用一個
<a href="https://example.com/testapp/Terms and Conditions.pdf">Terms and Conditions</a>鏈接?
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/420767.html
標籤:
