*/ protected $attributes = [ 'type' => 'file', ]; /** * Prepare the form element (mostly used for rendering purposes) */ public function prepareElement(FormInterface $form): void { // Ensure the form is using correct enctype $form->setAttribute('enctype', 'multipart/form-data'); } /** * @inheritDoc */ public function getInputSpecification(): array { $spec = [ 'type' => FileInput::class, 'required' => false, ]; $name = $this->getName(); if ($name !== null) { $spec['name'] = $name; } return $spec; } }