我无法使用HttpPostedFileBase,因为在我的控制器操作的HttpPostedFileBase下有红色下划线。我该如何解决?
public IActionResult Add(TheMobileSuit themobilesuits, HttpPostedFileBase photo)
答案 0 :(得分:0)
如果您使用的是.Net Framework,则需要确保您的项目引用System.Web.Abstractions
。如果您使用的是.Net Core,则需要使用IFormFile
,因为HttpPostedFileBase
在Core中不存在。
IFormFile:https://docs.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.iformfile?view=aspnetcore-3.0
HttpPostedFileBase:https://docs.microsoft.com/en-us/dotnet/api/system.web.httppostedfilebase?view=netframework-4.8