我已经检查了这个答案不同,但它们都没有工作对我来说,我在.cshtml代码如下:HTTPPostedFileBase总是控制器
<input type="file" name="PostedNRLFile" />
,然后在控制器我有
public JsonResult SaveRecord(NewAuditLetterViewModel viewModel, FormCollection all, string hvalue, HttpPostedFileBase PostedNRLFile)
哪个总是空,请在这帮我。
我已经尝试了一些东西,如在viewmodel中创建一个属性,这也是null。 还在我的beginform标签中使用了new { enctype = "multipart/form-data", id = "documentForm" }
。 另外检查它们只是源代码中的一个标签。
在您的视图中显示'BeginForm()'代码。 –
@using(Html.BeginForm(“SaveRecord”,“EditNewAuditLetter”,FormMethod.Post,new {enctype =“multipart/form-data”})) –
您应该编辑您的问题!但是你显示的东西可以正常工作。我假设你正在做一个正常的提交而不使用ajax? –