Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Upload files bigger than 2Mo Symfony2

Tags:

php

symfony

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

like image 933
Ajouve Avatar asked Jun 07 '15 00:06

Ajouve


2 Answers

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
like image 146
john Smith Avatar answered Sep 27 '22 23:09

john Smith


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
like image 34
nomayann Avatar answered Sep 27 '22 22:09

nomayann