1 form_example_tutorial.inc form_example_tutorial_10_submit($form, &$form_state)

Submit handler for form_example_tutorial_10().

File

modules/examples/form_example/form_example_tutorial.inc, line 757
This is the Form API Tutorial, originally from the Backdrop 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.
  backdrop_set_message(t('The form has been submitted and the image has been saved, filename: @filename.', array('@filename' => $file->filename)));
}