You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

32 lines
949 B

<?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',
])
],
])
;
}
}