<?php
|
|
|
|
namespace App\Form;
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\OptionsResolver\OptionsResolver;
|
|
use Symfony\Component\Validator\Constraints\File;
|
|
|
|
class CsvType extends AbstractType
|
|
{
|
|
public function buildForm(FormBuilderInterface $builder, array $options): void
|
|
{
|
|
$builder
|
|
->add('csv', FileType::class, [
|
|
'mapped' => false,
|
|
'label' => 'Fichier CSV',
|
|
'constraints' => [
|
|
new File([
|
|
'maxSize' => '10M',
|
|
'mimeTypes' => [
|
|
'text/csv',
|
|
'text/plain',
|
|
],
|
|
'mimeTypesMessage' => 'Type MIME inattendu',
|
|
])
|
|
],
|
|
])
|
|
;
|
|
}
|
|
}
|