First of all, I apologize for my English...
I'm having a problem with my music upload. I found thanks to Symfony Doc, how upload file and I set up my picture upload successfully. However I found a problem with my music upload, my dump in my controller indicates to me an error, and tells me that my file exceeds 2M, yet in my file php.ini, upload_max_filesize is defined at 256M. My code to upload my music it's same as the picture.
My Code :
namespace App\Form;
use App\Entity\Artist;
use App\Entity\Category;
use App\Entity\Music;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\File;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\FileType;
class MusicType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('title')
->add('description')
->add('picture', FileType::class, [
'mapped' => false,
'required' => false,
'constraints' => [
new File([
'maxSize' => '8M',
'mimeTypes' => [
'image/jpeg',
'image/png',
'image/webp'
]
])
],
'attr' => [
'accept'=>'.jpg, .jpeg, .png, .gif'
]
])
->add('music', FileType::class, [
'mapped' => false,
'constraints' => [
new File([
'maxSize' => '256M',
'mimeTypes' => [
'application/octet-stream',
'audio/mpeg',
'audio/mp3'
]
])
]
])
I've been looking for a soluce, but all the results refer me back to https://symfony.com/doc/current/reference/constraints/File.html#maxsize
If you are ideas, I'm interested.