Hi, I am using SWFupload button on a page to do file upload. Basically I am rendering part of a page using drupal_get_form('_gsfileupload_form') and the form constructor is this:

function _gsfileupload_form(&$form_state, $node_type) {
 ...
  $form['gsfileupload'] = array(
    '#type' => 'fieldset',
    '#title' => t('File upload'),
    '#collapsible' => FALSE,
    '#collapsed' => FALSE,
  );
  $form['gsfileupload']['upload'] = array(
    // blah blah 
  );
    
  return $form;  
}

My problem is if I change 'upload' in $form['gsfileupload']['upload'] to something else, the SWFupload button is disable. It only works with the key 'upload'.

This present a small problem because I was hoping to use $instance->name in hook_swfupload() to decide if I should do anything or not and I was hoping I can use my own name like $form['gsfileupload']['my_own_key']. Then in hook_swfupload() I can do this:

function gsfileupload_swfupload(&$file, $op, &$instance) {
  if ($instance->name != 'my_own_key') {
    return;
  }
  // do my thing
}

Am I overlooking something?

Thanks!

Comments

skilip’s picture

Status: Active » Closed (fixed)