Download files larger than 2Mo Symfony2

I am trying to upload files larger than 2Mo and I have this error in my form

The file is too large. Allowed maximum size is 2 MiB.

This is my model

/**
 * @var UploadedFile
 *
 * @Assert\File(maxSize = "32768k")
 * @Assert\Valid()
 */
protected $file;

and in my php.ini

post_max_size = 50M
upload_max_filesize = 50M

And I restarted apache

+4
source share
2 answers

the most likely apache uses a different php than the one you are editing ini

just phpinfo();

in AppKernel.php or app.php

and find the correct ini directory

in the example

Loaded Configuration File => /usr/local/etc/php/5.4/php.ini
+7
source

You can also set your custom values ​​in the .htaccess file in the root folder of your web directory:

# File size settings for uploads
php_value upload_max_filesize 50M
php_value post_max_size 50M
+2
source

All Articles