开发者论坛

 找回密码
 注册 (请使用非IE浏览器)
查看: 2409|回复: 0

请问各位先进Kendo UI于Controller同时处理upload file与create model

[复制链接]

0

精华

0

贡献

0

赞扬

帖子
1
软币
57
在线时间
0 小时
注册时间
2016-7-5
发表于 2016-7-5 11:55:24 | 显示全部楼层 |阅读模式
末学使用Kendo UI的经验很少,目前碰到controller于create model时需要同时upload file但无法如愿

尝试使用model binding的方式如下

Model:
public MyModel()
        {
            Files = new List<HttpPostedFileBase>();
        }

        [Display(Name = "序号")]
        public int ID { get; set; }

        [StringLength(100)]
        [Display(Name = "文件标题")]
        public string DocTitle { get; set; }

        public IEnumerable<HttpPostedFileBase> Files { get; set; }

View:
        @Html.EditorFor(model => model.Files)
        @Html.TextBoxFor(model => model.Files, new { type = "file", name = "Files", id = "Files" })

Controller:
        [AcceptVerbs(HttpVerbs.Post)]
        public ActionResult Notices_Create([DataSourceRequest]DataSourceRequest request, MyModel notices)

此处不知原因在提交create需求时notices.Files在controller会出现count=0的状况。
请问各位先进对于这样情境的处理经验为何?感激不尽

回复

使用道具 举报

Archiver|手机版|小黑屋|开发者网 ( 苏ICP备08004430号-2 )
版权所有:南京韵文教育信息咨询有限公司

GMT+8, 2024-4-30 21:10

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表