25 lines
693 B
PHP
25 lines
693 B
PHP
<?php
|
|
|
|
namespace App\Forms;
|
|
|
|
use Symfony\Component\Form\AbstractType;
|
|
use Symfony\Component\Form\Extension\Core\Type\FileType;
|
|
use Symfony\Component\Form\FormBuilderInterface;
|
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
|
|
|
class UploadFileForm extends AbstractType
|
|
{
|
|
public function __construct(private readonly UrlGeneratorInterface $urlGenerator)
|
|
{
|
|
}
|
|
|
|
public function buildForm(FormBuilderInterface $builder, array $options)
|
|
{
|
|
$builder
|
|
->setAction($this->urlGenerator->generate('app_upload'))
|
|
->add('file', FileType::class, [
|
|
'attr' => ['class' => 'hidden'],
|
|
'multiple' => true,
|
|
]);
|
|
}
|
|
} |