惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Engineering at Meta
Engineering at Meta
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Martin Fowler
Martin Fowler
雷峰网
雷峰网
Recent Announcements
Recent Announcements
博客园 - 叶小钗
F
Full Disclosure
C
Check Point Blog
A
About on SuperTechFans
L
LangChain Blog
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss
博客园 - 司徒正美
C
Cybersecurity and Infrastructure Security Agency CISA
C
CXSECURITY Database RSS Feed - CXSecurity.com
Cisco Talos Blog
Cisco Talos Blog
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
MongoDB | Blog
MongoDB | Blog
Project Zero
Project Zero
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Know Your Adversary
Know Your Adversary
D
Docker
U
Unit 42
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Exploit Database - CXSecurity.com
L
Lohrmann on Cybersecurity
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Latest news
Latest news
V
Visual Studio Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
L
LINUX DO - 最新话题
Google DeepMind News
Google DeepMind News
小众软件
小众软件
NISL@THU
NISL@THU
GbyAI
GbyAI
H
Heimdal Security Blog
Jina AI
Jina AI
I
InfoQ
PCI Perspectives
PCI Perspectives
P
Privacy International News Feed
P
Proofpoint News Feed
N
News and Events Feed by Topic
C
CERT Recently Published Vulnerability Notes
aimingoo的专栏
aimingoo的专栏
SecWiki News
SecWiki News
B
Blog RSS Feed
阮一峰的网络日志
阮一峰的网络日志

博客园 - 秃顶的大熊猫

Abp中的sweetalert的版本问题 - 秃顶的大熊猫 - 博客园 Asp.net Core 部署到Azure.cn的一个小问题 在ASP.NET MVC5 及 Visual Studio 2013 中为Identity账户系统配置数据库链接及Code-First数据库迁移 Windows Azure上的Odoo(OpenERP)-2.在Ubuntu虚拟机上部署Odoo(OpenERP) Windows Azure上的Odoo(OpenERP)-1.创建Ubuntu虚拟机,安装PostgreSQL 数据库 Windows Azure上的Odoo(OpenERP) Html.Label的缺陷及补救办法 真实场景中的SharePoint2010系列(开篇) Asp.Net Mvc 应用程序如何应对不同的URL地址?????,问题解决了 Asp.Net Mvc 应用程序如何应对不同的URL地址????? 为ASP.NET MVC配置基于Active Directory的表单认证方式 MOSS2007-学习笔记-备忘录-单点登录设置(2) MOSS2007-学习笔记-备忘录-单点登录-(1)-"我的网站'? 由公司协同工作平台项目引发的Windows Active Directory(活动目录域)的应用问题 似乎是发现了asp.net ajaxToolkit中TAB控件的一个BUG 动态创建ASP.NET AJAX Control Toolkit中的Accordion控件 学习SQLSERVER2005高可用性数据库镜像的一些心得 贴几张我儿子的照片,大家看看可爱不 哈哈,我回来了!
备忘录:Asp.net mvc中的UpLoad小技巧
秃顶的大熊猫 · 2010-08-15 · via 博客园 - 秃顶的大熊猫

这两天在构建Asp.net Mvc项目中,允许用户上传一个图片来当做自己的头像。

Html代码

<form method="post" enctype="multipart/form-data" action="/Home/UpLoadFile" >

      <input type="file" id=”uploadfile” />

      <input type="submit" value=”save” />

</Form>

Controller端代码

 [HttpPost]
 public ActionResult UpLoadFile( HttpPostedFileBase file)
{
     return View();
}
奇怪的是哪个File永远是个Null,急死人了,一天的时间浪费了!!!
查阅无数网站,英文不好也要逼着自己搜英文网站,搞了大半天,在一个英文网站上看到一句:
上传文件控件必须要有name值,而且在Controller端的HttpPostedFileBase file中的file必需就是Upload控件的name值。
晕!!倒!!!
加上试试吧,代码如下

<form method="post" enctype="multipart/form-data" action="/Home/UpLoadFile" >

    <input type="file" id=”uploadfile” name=”file” />

    <input type="submit" value=”save” />

</Form>

Controller端的代码就不写了,和上面是一样的。
经过跟踪,File再也不是Null。
写此文以备忘!!!