File interface

  1. 7.x drupal/includes/file.inc file
  2. 5.x drupal/includes/file.inc file
  3. 6.x drupal/includes/file.inc file
  4. 8.x drupal/core/includes/file.inc file

Common file handling functions.

Functions

Namesort descending Location Description
file_check_directory drupal/includes/file.inc Checks whether a directory exists and is writable.
file_check_location drupal/includes/file.inc Check if a file is really located inside $directory. Should be used to make sure a file specified is really located within the directory to prevent exploits.
file_check_path drupal/includes/file.inc Checks path to see if it is a directory, or a dir/file.
file_copy drupal/includes/file.inc Copies a file to a new location.
file_create_filename drupal/includes/file.inc Create a full file path from a directory and filename. If a file with the specified name already exists, an alternative will be used.
file_create_htaccess drupal/includes/file.inc Creates a .htaccess file in the given directory.
file_create_path drupal/includes/file.inc Make sure the destination is a complete path and resides in the file system directory, if it is not prepend the file system directory.
file_create_url drupal/includes/file.inc Create the download path to a file.
file_delete drupal/includes/file.inc Delete a file.
file_destination drupal/includes/file.inc Determines the destination path for a file depending on how replacement of existing files should be handled.
file_directory_path drupal/includes/file.inc Determine the default 'files' directory.
file_directory_temp drupal/includes/file.inc Determine the default temporary directory.
file_download drupal/includes/file.inc Call modules that implement hook_file_download() to find out if a file is accessible and what headers it should be transferred with. If a module returns -1 drupal_access_denied() will be returned. If one or more modules returned headers the download…
file_download_access drupal/includes/file.inc Checks that the current user has access to a particular file.
file_download_headers drupal/includes/file.inc Retrieves headers for a private file download.
file_get_mimetype drupal/includes/file.inc Determine an Internet Media Type, or MIME type from a filename.
file_htaccess_lines drupal/includes/file.inc Returns the standard .htaccess lines that Drupal writes to file directories.
file_move drupal/includes/file.inc Moves a file to a new location.
file_munge_filename drupal/includes/file.inc Modify a filename as needed for security purposes.
file_save_data drupal/includes/file.inc Save a string to the specified destination.
file_save_upload drupal/includes/file.inc Saves a file upload to a new location.
file_scan_directory drupal/includes/file.inc Finds all files that match a given mask in a given directory.
file_set_status drupal/includes/file.inc Set the status of a file.
file_space_used drupal/includes/file.inc Determine total disk space used by a single user or the whole filesystem.
file_transfer drupal/includes/file.inc Transfer file using http to client. Pipes a file through Drupal to the client.
file_unmunge_filename drupal/includes/file.inc Undo the effect of upload_munge_filename().
file_upload_max_size drupal/includes/file.inc Determine the maximum file upload size by querying the PHP settings.
file_validate_extensions drupal/includes/file.inc Check that the filename ends with an allowed extension. This check is not enforced for the user #1.
file_validate_image_resolution drupal/includes/file.inc If the file is an image verify that its dimensions are within the specified maximum and minimum dimensions. Non-image files will be ignored.
file_validate_is_image drupal/includes/file.inc Check that the file is recognized by image_get_info() as an image.
file_validate_name_length drupal/includes/file.inc Check for files with names longer than we can store in the database.
file_validate_size drupal/includes/file.inc Check that the file's size is below certain limits. This check is not enforced for the user #1.

Constants

Namesort descending Location Description
FILE_CREATE_DIRECTORY drupal/includes/file.inc
FILE_DOWNLOADS_PRIVATE drupal/includes/file.inc
FILE_DOWNLOADS_PUBLIC drupal/includes/file.inc
FILE_EXISTS_ERROR drupal/includes/file.inc
FILE_EXISTS_RENAME drupal/includes/file.inc
FILE_EXISTS_REPLACE drupal/includes/file.inc
FILE_MODIFY_PERMISSIONS drupal/includes/file.inc
FILE_STATUS_PERMANENT drupal/includes/file.inc
FILE_STATUS_TEMPORARY drupal/includes/file.inc A files status can be one of two values: temporary or permanent. The status for each file Drupal manages is stored in the {files} tables. If the status is temporary Drupal's file garbage collection will delete the file and remove it from the…

File

drupal/includes/file.inc, line 8
API for handling file uploads and server file management.