-1

For my Symfony project I need to upload some photos with a form.

All is working good for the sending when the file is under 2MB but when it's higher the server just tell me no. When I look at the Symfony Profiler to find the error I have this : enter image description here

But the problem is that I've never set a maximum value equals to 2MB, In my form type I've set it to 16 : enter image description here

So how can I bypass this limit of 2MB ?

Here is the post_max_size and the upload_max_filesize in the php.ini file. enter image description hereenter image description here

EnzoKilm
  • 29
  • 1
  • 7
  • 1
    try yo change the value of several parames in your php ini , parames are : upload_max_filesize , post_max_size . – MoxGeek Aug 17 '20 at 16:00
  • @MoxGeek they are already set to something bigger than 2 megs (I edited my post with thoose values) – EnzoKilm Aug 18 '20 at 08:35
  • if you did change tht php ini and restart your server not only refresh your page, that means there is something else wrong. do you have any annotation in your class ? im talking about @Assert one ? im asking this question becouse the message that you have in french can come from an maxSizeMessage attributs in the assert. or you are using a bundle that use this validation file and you need to see the yml configuration file of this bundle. can you provide more information please. – MoxGeek Aug 18 '20 at 11:25
  • I restarted my server and nothing changed. I have no @Assert annotation because in my database I only save the name of the file (so it's purely and simply a text column). I followed this tutorial from symfony : [here](https://symfony.com/doc/current/controller/upload_file.html#creating-an-uploader-service) – EnzoKilm Aug 18 '20 at 14:19

1 Answers1

1

You need to change values in your php.ini file

vim /etc/php.ini                   #Cent/RHEL/Fedora
vim /etc/php/*your.php.version*/apache2/php.ini   #Debian/Ubuntu

Change these values to what you think the user will upload (10M)

upload_max_filesize = 10M
post_max_size = 10M
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
MoxGeek
  • 458
  • 6
  • 17