Common file handling functions.

Constants

Namesort iconLocationDescription
FILE_STATUS_TEMPORARYdrupal-6/includes/file.incA 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...

Functions

Namesort iconLocationDescription
file_check_directorydrupal-6/includes/file.incCheck that the directory exists and is writable. Directories need to have execute permissions to be considered a directory by FTP servers, etc.
file_check_locationdrupal-6/includes/file.incCheck 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_pathdrupal-6/includes/file.incChecks path to see if it is a directory, or a dir/file.
file_copydrupal-6/includes/file.incCopies a file to a new location. This is a powerful function that in many ways performs like an advanced version of copy). Checks if $source and $dest are valid and readable/writable. Performs a file copy if $source is not equal to $dest. If file...
file_create_filenamedrupal-6/includes/file.incCreate 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_pathdrupal-6/includes/file.incMake 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_urldrupal-6/includes/file.incCreate the download path to a file.
file_deletedrupal-6/includes/file.incDelete a file.
file_destinationdrupal-6/includes/file.incDetermines the destination path for a file depending on how replacement of existing files should be handled.
file_directory_pathdrupal-6/includes/file.incDetermine the default 'files' directory.
file_directory_tempdrupal-6/includes/file.incDetermine the default temporary directory.
file_downloaddrupal-6/includes/file.incCall 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_get_mimetypedrupal-6/includes/file.incDetermine an Internet Media Type, or MIME type from a filename.
file_movedrupal-6/includes/file.incMoves a file to a new location. Checks if $source and $dest are valid and readable/writable. Performs a file move if $source is not equal to $dest. If file already exists in $dest either the call will error out, replace the file or rename the file...
file_munge_filenamedrupal-6/includes/file.incMunge the filename as needed for security purposes. For instance the file name "exploit.php.pps" would become "exploit.php_.pps".
file_save_datadrupal-6/includes/file.incSave a string to the specified destination.
file_save_uploaddrupal-6/includes/file.incSaves a file upload to a new location. The source file is validated as a proper upload and handled as such.
file_scan_directorydrupal-6/includes/file.incFinds all files that match a given mask in a given directory. Directories and files beginning with a period are excluded; this prevents hidden files and directories (such as SVN working directories) from being scanned.
file_set_statusdrupal-6/includes/file.incSet the status of a file.
file_space_useddrupal-6/includes/file.incDetermine total disk space used by a single user or the whole filesystem.
file_transferdrupal-6/includes/file.incTransfer file using http to client. Pipes a file through Drupal to the client.
file_unmunge_filenamedrupal-6/includes/file.incUndo the effect of upload_munge_filename().
file_upload_max_sizedrupal-6/includes/file.incDetermine the maximum file upload size by querying the PHP settings.
file_validate_extensionsdrupal-6/includes/file.incCheck that the filename ends with an allowed extension. This check is not enforced for the user #1.
file_validate_image_resolutiondrupal-6/includes/file.incIf 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_imagedrupal-6/includes/file.incCheck that the file is recognized by image_get_info() as an image.
file_validate_name_lengthdrupal-6/includes/file.incCheck for files with names longer than we can store in the database.
file_validate_sizedrupal-6/includes/file.incCheck that the file's size is below certain limits. This check is not enforced for the user #1.