与asp.net中几乎一样,使用表单提交的方式上传文件(如果是使用了第三方插件的话,那么就另当别论)

@{
    ViewBag.Title = "Index";
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <title>@ViewBag.Title</title>    
</head>
<body>
    <form id="form1" method="post"  enctype="multipart/form-data" action="@Url.Action("SaveFiles")">
        <input type="file" name="file" value="" />
        <br />
        <input type="submit" value="提交" /> 
    </form>
</body>
</html>
View中的代码

相关文章: