25
src/Forms/UploadFileForm.php
Normal file
25
src/Forms/UploadFileForm.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?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,
|
||||
]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user