1 file_example.module file_example_check_directory_submit($form, &$form_state)

Submit handler to test directory existence.

This actually just checks to see if the directory is writable

Parameters

array $form: FormAPI form.

array $form_state: FormAPI form state.

Related topics

File

modules/examples/file_example/file_example.module, line 471
Examples demonstrating the backdrop File API (and Stream Wrappers).

Code

function file_example_check_directory_submit($form, &$form_state) {
  $directory = $form_state['values']['directory_name'];
  $result = is_dir($directory);
  if (!$result) {
    backdrop_set_message(t('Directory %directory does not exist.', array('%directory' => $directory)));
  }
  else {
    backdrop_set_message(t('Directory %directory exists.', array('%directory' => $directory)));
  }
}