Ajouve
Ajouve

Reputation: 10089

Upload files bigger than 2Mo Symfony2

I am trying to upload files bigger than 2Mo and I have this error on 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 have restarted apache

Upvotes: 5

Views: 4981

Answers (2)

nomayann
nomayann

Reputation: 156

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

# File size settings for uploads
php_value upload_max_filesize 50M
php_value post_max_size 50M

Upvotes: 3

john Smith
john Smith

Reputation: 17906

most possible apache uses another php than the one you edit the ini

just phpinfo();

at the AppKernel.php or app.php

and look for the directory of the correct ini

in example

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

Upvotes: 12

Related Questions