File interface

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

Common file handling functions.

Functions & methods

NameDescription
file_check_directoryCheck that the directory exists and is writable. Directories need to have execute permissions to be considered a directory by FTP servers, etc.
file_check_locationCheck 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_pathChecks path to see if it is a directory, or a dir/file.
file_check_upload
file_copyCopies a file to a new location. This is a powerful function that in many ways performs like an advanced version of copy().
file_create_filenameCreate 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_pathMake 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_urlCreate the download path to a file.
file_deleteDelete a file.
file_directory_pathDetermine the default 'files' directory.
file_directory_tempDetermine the default temporary directory.
file_download
file_moveMoves a file to a new location.
file_save_dataSave a string to the specified destination.
file_save_uploadSaves a file upload to a new location. The source file is validated as a proper upload and handled as such.
file_scan_directoryFinds all files that match a given mask in a given directory. Directories and files beginning with a period are excluded.
file_transferTransfer file using http to client. Pipes a file through Drupal to the client.
file_upload_max_sizeDetermine the maximum file upload size by querying the PHP settings.
_file_convert_to_mbHelper function for file_upload_max_size().

Constants

NameDescription
FILE_CREATE_DIRECTORY
FILE_DOWNLOADS_PRIVATE
FILE_DOWNLOADS_PUBLIC
FILE_EXISTS_ERROR
FILE_EXISTS_RENAME
FILE_EXISTS_REPLACE
FILE_MODIFY_PERMISSIONS

File

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

Login or register to post comments