简体   繁体   English

播放Framework文件上传空参数

[英]Play Framework file upload empty params

Im working on a Play Framework 1.4 application using Apache2.4 as my webserver. 我正在使用Apache2.4作为Web服务器的Play Framework 1.4应用程序上工作。

I am trying to do a basic file upload however if I try to upload a file that is larger than 487KB the params are empty, if i upload a file thats less than 487KB the params are there and I can acccess the file from the tmp path. 我正在尝试执行基本文件上传,但是如果我尝试上传大于487KB的文件,则参数为空,如果我上传的文件小于487KB,则参数在这里,并且我可以从tmp路径访问文件。 Here is the code: 这是代码:

// File <= 487KB Logs "params: {file=[Ljava.lang.String;@160b7aab}"
// File > 487KB Logs "params: {}"
public static String uploadFile() {
    Logger.info("params: %s", params.all());
    return "";
}

I have my apache config setup to allow large size payloads and headers: 我有我的apache配置设置,以允许大型有效负载和标头:

LimitRequestFields 0
LimitRequestBody 0
LimitRequestFieldSize 2097152

Any advice on this would be great. 任何建议,这将是巨大的。

Okay so it turns out this was a Play Framework configuration limit. 好的,事实证明这是Play框架的配置限制。 Quite hard to find nested within their documentation. 很难找到嵌套在其文档中的内容。 You need to set the Max Content Length to whatever size files you want to upload (in bytes): 您需要将“最大内容长度”设置为要上传的任何大小的文件(以字节为单位):

play.netty.maxContentLength = 2097152

Alternately if you dont want a max size you can set it to -1 . 或者,如果您不希望最大尺寸,可以将其设置为-1

play.netty.maxContentLength = -1

Documentation here 这里的文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM