js动态在form上插入enctype=multipart/form-data的问题
我们都知道要让form能提交文件,需要在form上指定enctype=multipart/form-data的attribute,这样才能上传文件,关于enctype的文章很多,就不再做解释。 问题是因为使用了MVC的Html.BeginForm()来输出表单代码,默认是没有加入enctype的,
我们都知道要让form能提交文件,需要在form上指定enctype=multipart/form-data的attribute,这样才能上传文件,关于enctype的文章很多,就不再做解释。 问题是因为使用了MVC的Html.BeginForm()来输出表单代码,默认是没有加入enctype的,
实现代码如下: 那在Asp.net MVC web application中,我们可以这么实现: 实现代码如下: @using (Html.BeginForm("Upload", "Home", FormMethod.Post, new { enctype = "multipart/form-
方法一: Home/Index.aspx中的代码 实现代码如下: Homecontroller中的代码 [code] [AcceptVerbs(HttpVerbs.Post)] public ActionResult up(HttpPostedFileBase upfile) { if (u
相关的源代码如下: 1.beginFormPanel.js(作用:外层html文件中表单的展现) var beginFormPanel = Ext.extend(Ext.form.FormPanel,{ constructor:function() { beginFormPanel.supercl