我想使用 asp.net mvc2 上传和下载简历。我已经创建了编码。已成功上传。当我尝试下载文件时遇到问题..它显示一个空白页面..
控制器:
[HandleErrorWithAjaxFilter]
public ActionResult UploadResume(HttpPostedFileBase FileData)
{
Stream fromStream = FileData.InputStream;
Stream toStream = new FileStream(Server.MapPath("~/Content/Resumes/") + FileData.FileName, FileMode.Create);
LoggedInCandidate.ResumeFileName = FileData.FileName;
//_repository.Save();
_userRepository.Save();
return Json(new JsonActionResult
{
Success = true,
Message = "Resume has been uploaded."
});
//return Json("Resume has been uploaded.");
}
看法:
<input id="Resume" type="file" name="Resume" />
下载:
<p>
<% var link = Url.Content("~/Content/Resumes/") + Model.ResumeFileName; %>
<a href="<%: link %>">Download Resume</a>
</p>
当我单击链接下载简历时,它会在 url 处显示文件的名称,但它没有下载。