如何增加Symfony 2表单上的文件上传限制? [英] How to increase the upload limit for files on a Symfony 2 form?

查看:197
本文介绍了如何增加Symfony 2表单上的文件上传限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Symfony中有一个用户上传文件的表单。这些文件的大小可以达到50Mb。然而,当我尝试上传大约10Mb的文件时(在此之前,文件不大于7.2Mb )表单重新加载了这个错误:


上传的文件太大。请尝试上传一个较小的文件


这是一个验证错误,它不会显示为正确的Symfony2错误。 >

我已经将PHP.ini文件中的 upload_max_filesize 设置设置为50MB,所以10MB文件不应该是问题?

解决方案

您需要在php.ini中设置这两个:

  post_max_size = 50M 

upload_max_filesize = 50M


I have a form in Symfony where the user uploads files to. These files can be up to 50Mb in size.

However, when I try to upload a file that is about 10Mb (before this, the files were no bigger than 7.2Mb) the form reloads with this error:

The uploaded file was too large. Please try to upload a smaller file

This is a validation error, it doesn't appear as a proper Symfony2 error.

I've set the upload_max_filesize setting in the PHP.ini file to 50MB, so a 10MB file shouldn't be an issue?

解决方案

You need to set both of these in the php.ini:

post_max_size = 50M

upload_max_filesize = 50M

这篇关于如何增加Symfony 2表单上的文件上传限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆