You are here

function filefield_form_alter in FileField 6.3

Implementation of hook_form_alter().

Set the enctype on forms that need to accept file uploads.

File

./filefield.module, line 254
FileField: Defines a CCK file field type.

Code

function filefield_form_alter(&$form, $form_state, $form_id) {

  // Field configuration (for default images).
  if ($form_id == 'content_field_edit_form' && isset($form['#field']) && $form['#field']['type'] == 'filefield') {
    $form['#attributes']['enctype'] = 'multipart/form-data';
  }

  // Node forms.
  if (preg_match('/_node_form$/', $form_id)) {
    $form['#attributes']['enctype'] = 'multipart/form-data';
  }
}