ASP.NET MVC で単一の .csv ファイルをアップロードしようとしています。私の .ascx ファイルには、次のものがあります。
<div>
<input type="file" name="file" id="file" />
   
<input type="submit" name="btnSubmit" id="btnSubmit" value="Upload" />
</div>
コントローラーのアクションは次のとおりです。
public ActionResult Upload(HttpPostedFileBase file)
{
if (file.ContentLength > 0)
{
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/App_Data/uploads"), fileName);
file.SaveAs(path);
}
return View();
}
問題は、アップロード アクションで常にファイルを Null として取得することです。これを機能させる方法に関する提案はありますか?