Closed Lc5 closed 11 years ago
For automatic handling of file uploads, you need to also install symfony/http-foundation
and enable HttpFoundationExtension.
use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension;
$formFactory = Forms::createFormFactoryBuilder()
->addExtension(new CsrfExtension($csrfProvider))
->addExtension(new ValidatorExtension($validator))
->addExtension(new HttpFoundationExtension())
->getFormFactory();
Thanks for explanation!
Hello, I've got file upload field in my form. The data is correctly sent using POST, however, when using the following code, the UploadedFile object is not created, when calling "$form['attachment']->getData():"
$builder->add('attachment', 'file');
if ($form->isValid()) { $someNewFilename = ...
Calling $form->getData() returns, among others, an array of fields with user file names. I suppose the problem could be in FileBag not being called at all.