Linux SRV-16 6.18.44-paas #1 SMP PREEMPT_DYNAMIC Thu Aug 13 10:08:12 UTC 2026 x86_64
/
proc
/
212
/
task
/
212
/
root
/
proc
/
self
/
root
/
proc
/
212
/
root
/
proc
/
70528
/
cwd
/
src
/
Service
/
//proc/212/task/212/root/proc/self/root/proc/212/root/proc/70528/cwd/src/Service/FileValidator.php
<?php namespace App\Service; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\Form\FormError; use Symfony\Component\Form\FormInterface; class FileValidator { public function validate(UploadedFile $file, FormInterface $form, string $fieldName, array $allowedMimeTypes = ['image/jpeg', 'image/png'], array $allowedExtensions = ['jpg', 'jpeg', 'png']): bool { $mimeType = $file->getMimeType(); $extension = $file->guessExtension(); if (!in_array($mimeType, $allowedMimeTypes) || !in_array($extension, $allowedExtensions)) { $form->get($fieldName)->addError(new FormError('Type de fichier non autorisé.')); return false; } return true; } }