国外设计欣赏网站 - DOOOOR.com

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,微信登陆

搜索

[Drupal教程] Drupal的组成部分 5.文件上传系统

[复制链接]
发表于 11-29-2011 07:34 | 显示全部楼层 |阅读模式

Common file handling functions.

Fields on the file object:

  • fid - File ID
  • uid - The {users}.uid of the user who is associated with the file.
  • filename - Name of the file with no path components. This may differ from the basename of the filepath if the file is renamed to avoid overwriting an existing file.
  • filepath - Path of the file relative to Drupal root.
  • filemime - The file's MIME type.
  • filesize - The size of the file in bytes.
  • status - A bitmapped field indicating the status of the file. The first 8 bits are reserved for Drupal core. The least sigifigant bit indicates temporary (0) or permanent (1). Temporary files older than DRUPAL_MAXIMUM_TEMP_FILE_AGE will be removed during cron runs.
  • timestamp - UNIX timestamp for the date the file was added to the database.

常量

名称sort icon位置描述
FILE_CREATE_DIRECTORYincludes/file.incFlag used by file_check_directory() -- create directory if not present.
FILE_DOWNLOADS_PRIVATEincludes/file.incFlag to indicate that the 'private' file download method is enabled.
FILE_DOWNLOADS_PUBLICincludes/file.incFlag to indicate that the 'public' file download method is enabled.
FILE_EXISTS_ERRORincludes/file.incFlag for dealing with existing files: Do nothing and return FALSE.
FILE_EXISTS_RENAMEincludes/file.incFlag for dealing with existing files: Appends number until name is unique.
FILE_EXISTS_REPLACEincludes/file.incFlag for dealing with existing files: Replace the existing file.
FILE_MODIFY_PERMISSIONSincludes/file.incFlag used by file_check_directory() -- file permissions may be changed.
FILE_STATUS_PERMANENTincludes/file.incFile status -- This bit in the status indicates that the file is permanent and should not be deleted during file garbage collection process. Temporary files older than DRUPAL_MAXIMUM_TEMP_FILE_AGE will be removed during cron runs.

函数

名称sort icon位置描述
file_check_directoryincludes/file.incCheck that the directory exists and is writable.
file_check_locationincludes/file.incCheck if a file is really located inside $directory.
file_check_pathincludes/file.incChecks path to see if it is a directory, or a directory/file.
file_copyincludes/file.incCopy a file to a new location and adds a file record to the database.
file_create_filenameincludes/file.incCreate a full file path from a directory and filename.
file_create_pathincludes/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_urlincludes/file.incCreate the download path to a file.
file_deleteincludes/file.incDelete a file and its database record.
file_destinationincludes/file.incDetermines the destination path for a file depending on how replacement of existing files should be handled.
file_directory_pathincludes/file.incDetermine the default 'files' directory.
file_directory_tempincludes/file.incDetermine the default temporary directory.
file_downloadincludes/file.incMenu handler for private file transfers.
file_get_mimetypeincludes/file.incDetermine an Internet Media Type, or MIME type from a filename.
file_loadincludes/file.incLoad a file object from the database.
file_load_multipleincludes/file.incLoad file objects from the database.
file_moveincludes/file.incMove a file to a new location and update the file's database entry.
file_munge_filenameincludes/file.incMunge the filename as needed for security purposes.
file_saveincludes/file.incSave a file object to the database.
file_save_dataincludes/file.incSave a string to the specified destination and create a database file entry.
file_save_uploadincludes/file.incSaves a file upload to a new location.
file_scan_directoryincludes/file.incFinds all files that match a given mask in a given directory.
file_space_usedincludes/file.incDetermine total disk space used by a single user or the whole filesystem.
file_transferincludes/file.incTransfer file using HTTP to client. Pipes a file through Drupal to the client.
file_unmanaged_copyincludes/file.incCopy a file to a new location without calling any hooks or making any changes to the database.
file_unmanaged_deleteincludes/file.incDelete a file without calling any hooks or making any changes to the database.
file_unmanaged_moveincludes/file.incMove a file to a new location without calling any hooks or making any changes to the database.
file_unmanaged_save_dataincludes/file.incSave a string to the specified destination without calling any hooks or making any changes to the database.
file_unmunge_filenameincludes/file.incUndo the effect of upload_munge_filename().
file_upload_max_sizeincludes/file.incDetermine the maximum file upload size by querying the PHP settings.
file_validateincludes/file.incCheck that a file meets the criteria specified by the validators.
file_validate_extensionsincludes/file.incCheck that the filename ends with an allowed extension.
file_validate_image_resolutionincludes/file.incIf the file is an image verify that its dimensions are within the specified maximum and minimum dimensions.
file_validate_is_imageincludes/file.incCheck that the file is recognized byimage_get_info() as an image.
file_validate_name_lengthincludes/file.incCheck for files with names longer than we can store in the database.
file_validate_sizeincludes/file.incCheck that the file's size is below certain limits.

taxonomy:

 楼主| 发表于 11-30-2011 19:12 | 显示全部楼层
jvorc 发表于 2011-11-30 19:11
6 K1 c8 N, G3 ~' P9 B回复一下吧

9 G# N! K4 c0 s2 y+ v$ N脑子里的词,快用光了吧

|2011-2026-版权声明|平台(网站)公约|DOOOOR 设计网 ( 吉ICP备2022003869号 )

GMT+8, 2-12-2025 18:57 , Processed in 0.595762 second(s), 34 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表