小编Dor*_*anu的帖子

HttpPostedFileBase 缺少参考

我收到一个错误HttpPostedFileBase

找不到类型或命名空间名称“HttpPostedFileBase”(您是否缺少 using 指令或程序集引用?)

我已经尝试使用,using System.Web但根本不起作用。

编辑 #1

public IActionResult 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 RedirectToAction("index");
    }
Run Code Online (Sandbox Code Playgroud)

我实际上没有参考文件没有参考文件夹

c# asp.net asp.net-core

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

asp.net ×1

asp.net-core ×1

c# ×1