Hi everyone. I'm quite new to drupal and I'm writing a new content type / module. The aim is to show a spreadsheet file embedded in the browser using PHP-ExcelReader, but I'm getting confused with the file upload. I've been looking at the upload module, the filefield module and the handbooks but I don't get it. This is what I've written for the form up till now, not too much as you can see.
function spreadsheet_form(&$node) {
$form['title'] = array(
'#type' => 'textfield',
'#title' => t('Title'),
'#required' => TRUE,
);
$form['spreadsheet'] = array(
'#type' => 'fieldset',
'#title' => 'Spreadsheet',
'#collapsible' => TRUE,
'#collapsed' => FALSE,
'#tree' => TRUE,
);
$form['spreadsheet']['sfile'] = array(
'#type' => 'file',
'#description' => t('Select the spreadsheet file.'),
'#required' => TRUE,
'#tree' => FALSE,
);
$form['spreadsheet']['sbutton'] = array(
'#type' => 'button',
'#value' => t('Submit'),
'#tree' => FALSE,
);
return $form;
} //end function spreadsheet_form
What I want to know is how to add functionality to the submit button and make a preview like in the modules I mentioned. I just want one spreadsheet per page, so when you click submit the browse form should disappear.