This example demonstrates how to use the file API and the stream wrappers.

The File example module is part of the Examples for Developers project. You can download and experiment with this code at the Examples for Developers project page.

See File module public API functions and File Interface.

Parent topics

File

modules/examples/file_example/file_example.module, line 7
Hook implementations for the File Example module.

Functions

Name Locationsort ascending Description
file_example_menu modules/examples/file_example/file_example.module Implements hook_menu().
file_example_permission modules/examples/file_example/file_example.module Implements hook_permission().
file_example_intro modules/examples/file_example/file_example.module A simple introduction to the workings of this module.
file_example_readwrite modules/examples/file_example/file_example.module Form builder function.
file_example_managed_write_submit modules/examples/file_example/file_example.module Submit handler to write a managed file.
file_example_unmanaged_write_submit modules/examples/file_example/file_example.module Submit handler to write an unmanaged file.
file_example_unmanaged_php_submit modules/examples/file_example/file_example.module Submit handler to write an unmanaged file using plain PHP functions.
file_example_read_submit modules/examples/file_example/file_example.module Submit handler for reading a stream wrapper.
file_example_delete_submit modules/examples/file_example/file_example.module Submit handler to delete a file.
file_example_file_check_exists_submit modules/examples/file_example/file_example.module Submit handler to check existence of a file.
file_example_create_directory_submit modules/examples/file_example/file_example.module Submit handler for directory creation.
file_example_delete_directory_submit modules/examples/file_example/file_example.module Submit handler for directory deletion.
file_example_check_directory_submit modules/examples/file_example/file_example.module Submit handler to test directory existence.
file_example_show_session_contents_submit modules/examples/file_example/file_example.module Utility submit function to show the contents of $_SESSION.
file_example_get_managed_file modules/examples/file_example/file_example.module Utility function to check for and return a managed file.
file_example_stream_wrappers modules/examples/file_example/file_example.module Implements hook_stream_wrappers().
file_example_session_contents modules/examples/file_example/file_example.module Show the contents of a session file.
file_example_autoload_info modules/examples/file_example/file_example.module Implements hook_autoload_info().

Classes

Name Locationsort ascending Description
FileExampleTest modules/examples/file_example/tests/file_example.test Functional tests for the File Example module.
FileExampleSessionStreamWrapper modules/examples/file_example/file_example_session_streams.inc Example stream wrapper class to handle session:// streams.