change node types file fields widgets programatically? I have installed multi_upload_filefield_widget.

I would like to change every file widget of every file type fields of every node type programatically.

i would need to automate this change since i have multiple sites and multiple content type.

  //when enabling the module
  function multi_upload_filefield_widget_enable() {
        //code to loop through all node types fields for one site

       // if type is file 
            // replace widget 'file' to 'multiupload
            //save content type with this new value
}


Here is where i am at

       $types = node_type_get_types();

       foreach ($types as $type){   
           $fields=field_info_instances("node",$type-&gt;type);

            foreach ($fields as $field){
               if ($field['widget']['module']=='file'){         
                    $field['widget']['module']='multiupload_filefield_widget';
                    $field['widget']['type']='file_mfw';
                }
                 // my fields don't get saved !?
                //field_attach_update("node", $field);
                 //field_update_field ( $field );
             }


          $fields=field_info_instances("node",$type-&gt;type);
          print_r($fields);
        }


How can i save these modified fields ?

any help would be appreciated
It seems like this could do the job:
Programmatically change form widget type for a field