Browse Source

Merge pull request #67 from phansys/patch-4

Fix form without enctype="multipart/form-data" (Issues 228, 677)
Thomas 13 years ago
parent
commit
0070e57c5f
1 changed files with 4 additions and 0 deletions
  1. 4 0
      Resources/views/CRUD/edit_orm_one_association_script.html.twig

+ 4 - 0
Resources/views/CRUD/edit_orm_one_association_script.html.twig

@@ -43,6 +43,10 @@ This code manage the one-to-many association field popup
             data: { _xml_http_request: true },
             data: { _xml_http_request: true },
             success: function(html) {
             success: function(html) {
                 jQuery('#field_container_{{ id }}').replaceWith(html); // replace the html
                 jQuery('#field_container_{{ id }}').replaceWith(html); // replace the html
+								if(jQuery(form + 'input[type="file"]').length > 0) {
+									jQuery(form).attr('enctype', 'multipart/form-data');
+									jQuery(form).attr('encoding', 'multipart/form-data');
+								}
                 jQuery('#sonata-ba-field-container-{{ id }}').trigger('sonata.add_element');
                 jQuery('#sonata-ba-field-container-{{ id }}').trigger('sonata.add_element');
             }
             }
         });
         });