【问题标题】:Multiple file upload ExtJs 4 via ASP MVC多文件上传 ExtJs 4 通过 ASP MVC
【发布时间】:2015-02-26 08:52:53
【问题描述】:

我正在使用 ExtJs4 上传多个文件。 服务器端 - ASP MVC。

我的问题:来自 extJS 的请求无法在操作方法中捕获!

分机代码:

{
                    xtype: 'form',           
                    itemId: 'importForm',
                    layout: {
                        type: 'hbox'
                    },
                    items: [       
                        {
                            xtype: 'filefield',
                            name: 'IncFile',
                            fieldLabel: 'Choose files',
                            labelWidth: 200,
                            msgTarget: 'side',
                            allowBlank: false,
                            anchor: '100%',
                            buttonText: 'Choose',
                            listeners: {
                                afterrender: function (field) {
                                    field.fileInputEl.set({
                                        multiple: 'multiple'
                                    });
                                }
                            }
                        },
                        {
                            xtype: 'button',
                            text: 'Load',
                            handler: function () {
                                var form = this.up('form').getForm();
                                if (form.isValid()) {
                                    form.submit({
                                        url: 'Loader/Test',
                                        waitMsg: 'Loading...',
                                        success: function (fp, o) {
                                            Ext.Msg.alert('Success','some message....');
                                        }
                                    });
                                }
                            }
                        }
                    ]          
                }

MVC 控制器中的操作:

        [HttpPost]
        public ActionResult Test()
        {
           //some code
        }

所以,如果我只上传一个文件 - 没关系。我可以从 Request.Files 中得到它。 但是,这不适用于多个文件! 请求失败并显示“404 not found”。

这里是请求载荷:

------WebKitFormBoundaryRkYIPo3BvQMnKfIJ
Content-Disposition: form-data; name="IncFile"; filename="file1.zip"
Content-Type: application/x-zip-compressed


------WebKitFormBoundaryRkYIPo3BvQMnKfIJ
Content-Disposition: form-data; name="IncFile"; filename="file2.zip"
Content-Type: application/x-zip-compressed


------WebKitFormBoundaryRkYIPo3BvQMnKfIJ
Content-Disposition: form-data; name="IncFile"; filename="file3.zip"
Content-Type: application/x-zip-compressed


------WebKitFormBoundaryRkYIPo3BvQMnKfIJ--

【问题讨论】:

标签: c# asp.net-mvc file-upload extjs4 request


【解决方案1】:

所以... web.config 中的原因。我的文件比较大。

这解决了我的问题。

  <system.webServer>
      .............
    <security>
      <requestFiltering>
        <requestLimits maxAllowedContentLength="4294967295" />
      </requestFiltering>
    </security>
  </system.webServer>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-06-19
    • 2016-05-04
    • 1970-01-01
    • 2013-07-29
    • 1970-01-01
    • 2012-12-28
    • 2011-06-22
    • 1970-01-01
    相关资源
    最近更新 更多