sonata-project/SonataDoctrineORMAdminBundle — pull request #152 by to0om (2012-10-19 10:00:20+00:00)
Title: Fixed a bug where form didn't switch to multipart/form-data when necessary

Hello!

I noticed that the form enctype is not correctly switched to ```multipart/form-data``` if a file input is added to a one-to-many collection in Sonata Admin. This is because a jQuery selector is not used correctly. The jQuery docs at http://api.jquery.com/jQuery/ state:

```jQuery( selector [, context] )```

The ```context``` in this case is the ```form``` variable which is instantiated on line 31:

```var form = jQuery(this).closest('form');```

So line 46 should be:

```if(jQuery('input[type="file"]', form).length > 0)```

I've tested this in the master branch and it works.