fabpot/Silex — Issue #221: Exception when using 'file' type on forms
Author: leafnode
Created: 2011-12-19 16:04:30+00:00
State: open

Hi

I'm not sure if it's a problem with Silex, Symfony or Twig, but I'm gonna try here.

I'm trying to use 'fie' type with a form builder. Only for "file" type I get that exception:
```
Twig_Error_Runtime: Method "file" for object "Symfony\Component\Form\FormView" does not exist
```
(if I change this to "text" it's working fine. I get different exception for "birthday" (Class 'IntlDateFormatter' not found), but it was just a test so I didn't debug that further)

I'm initializing form like that:
```php
$form = $app['form.factory']
->createBuilder('form')
->add('title', 'text', array('label' => 'Tytuł'))
->add('fileUpload', 'file', array('label' => 'Plik'))
->getForm();
```
I'm using generic view:
```html

{{ form_widget(form) }}

```
but I also tried displaying form "manually":
```html

{{ form_row(form.title) }}
{{ form_row(form.fileUpload) }}

{{ form_rest(form) }}

```
and it's the same.

I'm using current silex, twig and symfony from github.

My code is similar to what can be seen in https://github.com/helios-ag/Silex-Upload-File-Example/ repository, so my solution should theoretically work.

Is that my fault or something with the code?