【问题标题】:Extjs - upload multi type fileExtjs - 上传多类型文件
【发布时间】:2013-06-26 13:58:34
【问题描述】:

我有像这样的文件字段的 tbar

    tbar: [{
        xtype: 'form',
        enctype: 'multipart/form-data',
        name: 'myforms',
        border: false,
        items: [{
            xtype: 'filefield',
            name: 'myname[]',
            buttonText:'add'
        }]
    }]

我尝试上传 zip 文件、mp4 文件……但无法正常工作。它使用简单的类型示例:txt、doc、...
我的提交使用

form.submit({
    method: 'POST',
    enctype: 'multipart/form-data',
    ....
});

如何解决这个问题,谢谢

编辑
我尝试更多,我看看文件 > 大约 2M,它不会上传。 :( 我没有捕获任何大小超过 2M 的文件。我怎样才能上传更多 2M 谢谢

【问题讨论】:

    标签: extjs file-upload upload extjs4.1


    【解决方案1】:

    很可能是服务器端的限制。我知道例如 IIS 具有允许您更改默认大小的配置选项 - 也就是说,如果您使用的是 IIS + WCF 或类似的东西。

    你的服务器后端是什么?

    【讨论】:

    【解决方案2】:

    你可以这样做:

    uploadFile: function(request) {
        var file = request.file;
            data = new FormData();
        data.append('file', file);
        Ext.Ajax.request({
            url: url ,
            scope: this,
            rawData: data,
            headers: {'Content-Type':null},
            success: function(response) {
               var responseData = Ext.JSON.decode(response.responseText, true);
            }
        });
    }
    

    在你的 spring boot 中的 application.properties 中:

    spring.http.multipart.max-file-size=50MB spring.http.multipart.max-request-size=50MB 如果你使用的是spring boot。

    【讨论】:

    • 您能解释一下这如何解决大于 2 MB 的文件出现的问题吗?
    • 哦,是的,忘了把它放在你的 application.properties spring.http.multipart.max-file-size=50MB spring.http.multipart.max-request-size=50MB
    • 感谢您编辑您的答案!你也不需要评论。
    猜你喜欢
    • 2013-06-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-04
    • 2012-03-24
    相关资源
    最近更新 更多