form_example_tutorial_10_submit

6 form_example_tutorial.inc form_example_tutorial_10_submit($form, &$form_state)
7 form_example_tutorial.inc form_example_tutorial_10_submit($form, &$form_state)
8 form_example_tutorial.inc form_example_tutorial_10_submit($form, &$form_state)

Submit handler for form_example_tutorial_10().

File

form_example/form_example_tutorial.inc, line 739
This is the Form API Tutorial from the handbook.

Code

function form_example_tutorial_10_submit($form, &$form_state) {
  $file = $form_state['storage']['file'];
  // We are done with the file, remove it from storage.
  unset($form_state['storage']['file']);
  // Make the storage of the file permanent
  $file->status = FILE_STATUS_PERMANENT;
  // Save file status.
  file_save($file);
  // Set a response to the user.
  drupal_set_message(t('The form has been submitted and the image has been saved, filename: @filename.', array('@filename' => $file->filename)));
}
Login or register to post comments