src/Form/UploadFormType.php line 12
<?phpnamespace App\Form;use App\Entity\ImageMetadata;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 UploadFormType extends AbstractType{public function buildForm(FormBuilderInterface $builder, array $options){$builder// ...->add('media', FileType::class, ['label' => 'Media',// unmapped means that this field is not associated to any entity property'mapped' => false,// make it optional so you don't have to re-upload the PDF file// every time you edit the Product details'required' => false,// unmapped fields can't define their validation using annotations// in the associated entity, so you can use the PHP constraint classes//https://www.iana.org/assignments/media-types/media-types.xhtml -- see mimiTypes'constraints' => [new File(['maxSize' => '10240k','mimeTypes' => ['application/pdf','application/x-pdf','image/png','image/*'],'mimeTypesMessage' => 'Please upload a valid PDF document',])],])// ...;}public function configureOptions(OptionsResolver $resolver): void{$resolver->setDefaults(['data_class' => ImageMetadata::class,'method' =>'POST','csrf_token_id' => 'login_form_csrf' // <- explicit variable]);}}