简体   繁体   English

不要上传超过10mb的primefaces

[英]Don't upload more than 10mb primefaces

I'm having problem and it look's simple, but I don't find a answer...Maybe someone could help me? 我有问题,看起来很简单,但我没有找到答案......也许有人可以帮助我? I'm using fileUpload from primefaces 5.0 and I can't do uploads of files that have more than 10mb... One file with 9.9mb works fine! 我正在使用来自primefaces 5.0的fileUpload,我不能上传超过10mb的文件......一个9.9mb的文件工作正常! =o = O

What I need to change to increase this limit? 我需要改变什么来增加这个限制?

Codes: 代码:

<p:fileUpload multiple="false"  cancelLabel="Cancelar" label="Selecionar Brasão..." fileUploadListener="#{back.uploadArquivo}" mode="advanced" dragDropSupport="true" auto="false" 
         fileLimit="1" sizeLimit="51380224"    update="panel_grid_upload_arquivo, :growl" />

backBean: backBean:

  public void uploadArquivo(FileUploadEvent event) {
    DocumentoEntity arquivo = new DocumentoEntity();
    try {
        arquivo.setArquivo(IOUtils.toByteArray(event.getFile().getInputstream()));
        arquivo.setNomeArquivo(event.getFile().getFileName());
        arquivo.setNome(event.getFile().getFileName());
        this.arquivo = arquivo;
        exibirMensagemSucesso("Upload feito com sucesso", "O arquivo agora está associado ao documento");
    } catch (IOException e) {
        exibirMensagemErro("Ocorreu algum erro", "Ocorreu algum erro e o upload não pôde ser feito");
        LOGGER.error("Não realizou o upload do arquivo");
        e.printStackTrace();
    }

}

web.xml: web.xml中:

<filter>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<filter-class>org.primefaces.webapp.filter.FileUploadFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>PrimeFaces FileUpload Filter</filter-name>
<servlet-name>Faces Servlet</servlet-name>
</filter-mapping>

A file with more than 10mb don't reach the BackBean... Thanks in advance! 超过10mb的文件没有到达BackBean ...提前谢谢!

I discover the problem after some hours... and was really so simple. 几个小时后我发现了这个问题......真的很简单。 This happened because Wildfly 8! 这是因为Wildfly 8! I need to put max-post-size="50485760" in the standalone.xml and now works fine. 我需要在standalone.xml中放置max-post-size =“50485760”,现在工作正常。

<server name="default-server">
            <http-listener name="default" socket-binding="http" max-post-size="50485760"/>
            <host name="default-host" alias="localhost">
                <location name="/" handler="welcome-content"/>
                <filter-ref name="server-header"/>
                <filter-ref name="x-powered-by-header"/>
            </host>
        </server>

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

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