.Net 文件上传如何获取文件的全路径

liu1459542530 liu1459542530 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
前台页面
<% using (Html.BeginForm("ContractUpFile", "Employees", FormMethod.Post, new { enctype = "multipart/form-data" }))
{ %>
<div style="margin:0 5px 5px 20px;">
<fieldset style="height:280px; ">
<legend>上传合同信息</legend>

<p style=" position:absolute; margin-left:10px; margin-top:10px;">

<label for="upFile">选择上传合同文件:<a href="/Employees/ContractUpFileExcelDemo">下载模板</a></label>
<input type="file" name="upFile" style=" width:600px; height:25px;" /><br />
<input type="hidden" name="emp_no" id="emp_no" />
</fieldset>
</div>
<%}%>

后台代码:
public ActionResult ContractUpFile(HttpPostedFileBase upFile)
{
object fileName=upFile.FileName;//获取的是上传文件的文件名,不是全路径
}
...全文
评论 10
收藏 已收藏
分享
返回顶部
liu1459542530
.NET社区 62,271 成员 668,968 内容