How to add custom attributes to a field? I would like to be able to add a handful of custom attributes to a filefield.  The attributes will be used by other modules to manage the uploaded files.

For example:
Admin creates a filefield and adds a "youtube" attribute, meaning that videos uploaded to this filefield should get transferred to youtube.  

I see that the database table content_node_field (which contains a row for each defined field) has a general_settings column that stores serialized data.  I am assuming this is a good place to store my custom field attributes.  

Question #1:
How to set/get custom attributes stored under the "general_settings" column?

Question #2:
How to customize the filefield widget so that when admin defines a particular filefield, she can also select values for these custom attributes. 

(I am using Drupal 6.)

Thank you!
The database table "content_node_field_instance" has a "widget_settings" column which can be used to store field attributes.  Use hook_widget_settings_alter() to associate attributes with a field.  Admin will then be able to set attribute values from the cck UI.  For example, to associate a binary attribute "my_attribute" with every filefield:

function mymodule_widget_settings_alter(&amp;$settings, $op, $widget) {

  // Apply to all FileFields 
  $widget_types = _content_widget_types();
  $widget_type = isset($widget['widget_type']) ? $widget['widget_type'] : $widget['type'];
  if (!in_array('filefield', $widget_types[$widget_type]['field types'])) {
    return;
  }

  switch ($op) {
      case 'form': 
        $settings['my_attribute'] = array(
          '#type' =&gt; 'checkbox',
          '#title' =&gt; t('my attribute'),
          '#options' =&gt; array(0 =&gt; t('Disabled'), 1 =&gt; t('Enabled')),
          '#default_value' =&gt; !empty($widget['my_attribute']),
        );

        break;
      case 'save':
        $settings[] = 'my_attribute';
        break;
  }
}


In this example, the filefield form will contain a checkbox labeled "my attribute".  Admin checks the box to set my_attribute to true, for the particular filefield.

To get the attribute value of a particular field:

$attribute_value = $field['widget']['my_attribute'];