file_example.module

Version 1.2 (checked in on 2010/12/15 at 22:16:19 by rfay)

Examples demonstrating the Drupal File API (and Stream Wrappers).

Functions & methods

NameDescription
file_example_check_directory_submitSubmit handler to test directory existence. This actually just checks to see if the directory is writable
file_example_create_directory_submitSubmit handler for directory creation. Here we create a directory and set proper permissions on it using file_prepare_directory().
file_example_delete_directory_submitSubmit handler for directory deletion.
file_example_delete_submitSubmit handler to delete a file.
file_example_file_check_exists_submitSubmit handler to check existence of a file.
file_example_get_managed_fileUtility function to check for and return a managed file. In this demonstration code we don't necessarily know if a file is managed or not, so often need to check to do the correct behavior. Normal code would not have to do this, as it would be…
file_example_managed_write_submitSubmit handler to write a managed file.
file_example_menuImplements hook_menu() to set up the URLs (menu entries) for the file examples.
file_example_permissionImplements hook_permission().
file_example_readwriteForm builder function for the file example readwrite and directory creation example.
file_example_read_submitSubmit handler for reading a stream wrapper.
file_example_session_contentsA utility function to allow us to see what is in a session "file".
file_example_show_session_contents_submitUtility submit function for debugging: Show $_SESSION.
file_example_stream_wrappersImplements hook_stream_wrappers(). hook_stream_wrappers() is Drupal's way of exposing the class that PHP will use to provide a new stream wrapper class. In this case, we'll expose the 'session' scheme, so a file reference like…
file_example_unmanaged_php_submit
file_example_unmanaged_write_submit