Common file handling functions.

Functions

Namesort iconLocationDescription
file_check_directorydrupal-5/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-5/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-5/includes/file.incChecks path to see if it is a directory, or a dir/file.
file_copydrupal-5/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-5/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-5/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-5/includes/file.incCreate the download path to a file.
file_deletedrupal-5/includes/file.incDelete a file.
file_directory_pathdrupal-5/includes/file.incDetermine the default 'files' directory.
file_directory_tempdrupal-5/includes/file.incDetermine the default temporary directory.
file_get_mimetypedrupal-5/includes/file.incDetermine an Internet Media Type, or MIME type from a filename.
file_movedrupal-5/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_save_datadrupal-5/includes/file.incSave a string to the specified destination.
file_save_uploaddrupal-5/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-5/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_transferdrupal-5/includes/file.incTransfer file using http to client. Pipes a file through Drupal to the client.
file_upload_max_sizedrupal-5/includes/file.incDetermine the maximum file upload size by querying the PHP settings.