file.inc

Version 1.227 (checked in on 2010-09-01 at 20:08:17 by dries)

API for handling file uploads and server file management.

Constants

NameDescription
FILE_CREATE_DIRECTORYFlag used by file_prepare_directory() -- create directory if not present.
FILE_EXISTS_ERRORFlag for dealing with existing files: Do nothing and return FALSE.
FILE_EXISTS_RENAMEFlag for dealing with existing files: Appends number until name is unique.
FILE_EXISTS_REPLACEFlag for dealing with existing files: Replace the existing file.
FILE_MODIFY_PERMISSIONSFlag used by file_prepare_directory() -- file permissions may be changed.
FILE_STATUS_PERMANENTIndicates that the file is permanent and should not be deleted.

Functions

NameDescription
drupal_chmodSet the permissions on a file or directory.
drupal_dirnameGets the name of the directory from a given path.
drupal_mkdirCreates a directory using Drupal's default mode.
drupal_realpathReturns the absolute path of a file or directory
drupal_rmdirRemove a directory.
drupal_tempnamCreates a file with a unique filename in the specified directory.
drupal_unlinkDeletes a file.
file_build_uriGiven a relative path, construct a URI into Drupal's default files location.
file_copyCopies a file to a new location and adds a file record to the database.
file_create_filenameCreate a full file path from a directory and filename.
file_create_htaccessCreates an .htaccess file in the given directory.
file_create_urlCreates a web-accessible URL for a stream to an external or local file.
file_default_schemeGet the default file stream implementation.
file_deleteDelete a file and its database record.
file_destinationDetermines the destination path for a file depending on how replacement of existing files should be handled.
file_directory_tempGet the path of system-appropriate temporary directory.
file_downloadMenu handler for private file transfers.
file_ensure_htaccessIf missing, create a .htaccess file in each Drupal files directory.
file_get_mimetypeDetermine an Internet Media Type, or MIME type from a filename.
file_get_stream_wrappersDrupal stream wrapper registry.
file_loadLoad a file object from the database.
file_load_multipleLoads file objects from the database.
file_moveMove a file to a new location and update the file's database entry.
file_munge_filenameModify a filename as needed for security purposes.
file_prepare_directoryCheck that the directory exists and is writable.
file_saveSave a file object to the database.
file_save_dataSave a string to the specified destination and create a database file entry.
file_save_uploadSaves a file upload to a new location.
file_scan_directoryFinds all files that match a given mask in a given directory.
file_space_usedDetermine total disk space used by a single user or the whole filesystem.
file_stream_wrapper_get_classReturns the stream wrapper class name for a given scheme.
file_stream_wrapper_get_instance_by_schemeReturns a reference to the stream wrapper class responsible for a given scheme.
file_stream_wrapper_get_instance_by_uriReturns a reference to the stream wrapper class responsible for a given URI.
file_stream_wrapper_uri_normalizeNormalizes a URI by making it syntactically correct.
file_stream_wrapper_valid_schemeCheck that the scheme of a stream URI is valid.
file_transferTransfer file using HTTP to client.
file_unmanaged_copyCopies a file to a new location without invoking the file API.
file_unmanaged_deleteDelete a file without calling any hooks or making any changes to the database.
file_unmanaged_delete_recursiveRecursively delete all files and directories in the specified filepath.
file_unmanaged_moveMove a file to a new location without calling any hooks or making any changes to the database.
file_unmanaged_save_dataSave a string to the specified destination without invoking file API.
file_unmunge_filenameUndo the effect of upload_munge_filename().
file_upload_max_sizeDetermine the maximum file upload size by querying the PHP settings.
file_uri_schemeReturns the scheme of a URI (e.g. a stream).
file_uri_targetReturns the part of an URI after the schema.
file_usage_addRecords that a module is using a file.
file_usage_deleteRemoves a record to indicate that a module is no longer using a file.
file_usage_listDetermines where a file is used.
file_validateCheck that a file meets the criteria specified by the validators.
file_validate_extensionsCheck that the filename ends with an allowed extension.
file_validate_image_resolutionVerify that image dimensions are within the specified maximum and minimum.
file_validate_is_imageCheck that the file is recognized by image_get_info() as an image.
file_validate_name_lengthCheck for files with names longer than we can store in the database.
file_validate_sizeCheck that the file's size is below certain limits.

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options