File handling
Provides access to File System Resources, this includes virtual file systems like ram, s3, git, ftp and ssh
Functions
- ContractPath()
Does the opposite of the function expandPath(). Tries to match given absolute path to the mappings in the environment. When no mappings match, lucee creates a relative path from the current position.
- DirectoryCopy()
Copies the contents of a directory to a destination directory.
- DirectoryCreate()
Creates new directory for specified path
- DirectoryDelete()
Deltes directory for given path
- DirectoryExists()
Determines whether a directory exists.
- DirectoryInfo()
returns detailed info about the given directory.
- DirectoryList()
Lists the contents of a specified directory and returns the list as an array or a query.
- DirectoryRename()
Renames given directory
- ExpandPath()
Creates an absolute, platform-appropriate path that is equivalent to the value of relative_path, appended to the base path. This function (despite its name) can accept an absolute or relative path in the relative_path attribute
- FileAppend()
appends the entire content to the specified file.
- FileClose()
Closes an file that is open.
- FileCopy()
Copies the specified on-disk or in-memory source file to the specified destination file.
- FileDelete()
Deletes the specified file on the server.
- FileExists()
Determines whether a file exists
- FileGetMimeType()
Returns the mimetype of the given file
- FileInfo()
returns detailed info about the given file.
- FileIsEOF()
Determines whether Lucee has reached the end of the file while reading it.
- FileModeToSymbolic()
Converts a mode mask to it's symbolic representation.
- FileMove()
Moves file from source to destination
- FileOpen()
Opens an file to read, write, or append.
- FileRead()
Reads an on-disk or in-memory text file or a file object created with the FileOpen function.
- FileReadBinary()
Reads an on-disk or in-memory binary file (such as an executable or image file) on the server, into a binary object
- FileReadLine()
Reads a line from an file.
- FileSeek()
Shifts the file pointer to the given position. The file must be opened with seekable option
- FileSetAccessMode()
Sets the attributes of an on-disk file on UNIX or Linux. This function does not work with in-memory files.
- FileSetAttribute()
For the given path, sets the file attributes.
- FileSetLastModified()
For the given file, set the last modification date
- FileSkipBytes()
Shifts the file pointer by the given number of bytes.
- FileTouch()
Touches given file, creates the file if not already exists.
- FileUpload()
Uploads file to a directory on the server.
- FileUploadAll()
Uploads file to a directory on the server.
- FileWrite()
If you specify a file path, writes the entire content to the specified file. If you specify a file object, writes text or binary data to the file object.
- FileWriteLine()
Opens up the file (or uses the existing file object) and appends the given line of text
- GetCanonicalPath()
Returns the canonical pathname string based on the given string.
- GetCurrentTemplatePath()
Gets the absolute path of the page that calls this function.
- GetDirectoryFromPath()
Extracts a directory from an absolute path. Returns the absolute path, without the filename.
- GetFileFromPath()
Extracts a filename from an absolute path.
- GetFileInfo()
Retrieves information about file.
- GetFreeSpace()
Returns the number of unallocated bytes in the partition named by this abstract path name.
- GetProfileSections()
Gets all the sections of an initialization file. An initialization file, as a struct whose format is as follows: - Each initialization file section name is a key in the struct - Each list of entries in a section of an initialization file is a value in the struct
- GetProfileString()
Gets an initialization file entry.
- GetTempDirectory()
Returns the full path to the currently assigned temporary directory, optionally creating a unique temp directory
- GetTempFile()
Creates a unique temporary file with a prefix in a directory.
- GetTotalSpace()
Returns the size of the partition named by this abstract pathname.
- GetVFSMetaData()
Returns metadata about the Virtual File system (VFS)
- ImageWrite()
Writes a image to the specified filename or destination.
- IsFileObject()
Determines whether a value is an file object. True, if the value represents a file object.
- IsImageFile()
Verifies whether an image file is valid.
- IsZipFile()
Verifies whether an zip file is valid.
- SetProfileString()
Sets the value of a profile entry in an initialization file.
Tags
- <cfdirectory>
Handles interactions with directories.
- <cffile>
Handles all interactions with files
Categories
- S3
Provides access to S3 resources
Guides
- <cffileupload>
This tag is not supported by Lucee.
- Define a mapping
All about the different mappings in Lucee and how to use them.
- Directory Placeholders
Placeholders are uses to reference specific Lucee directories
- File system - Mappings
Overview of different mapping types in the file system.
- File System Types
Lucee gives you access to a number of resources Local Files Provides access to the files on the local physical file system. Format
lucee [file://] absolute-path
Where absolute-path is a valid absolute file name for the local filesystem. Examples ```lucee /home/someuser/somedir c:\program files\some dir c:/program files/some dir file://home/someuser/somedir file://C:/Documents and Settings file:////somehost/someshare/afile - File Upload Operation Result
Return a struct with the information about the file upload operations as the result of cffile action=&quot;upload&quot;, FileUpload(), or FileUploadAll(). General Information | Key | Description | |----------------------|-------------| | attemptedServerFile | Name of the file that Lucee attempted to save | | clientDirectory | Directory of the uploaded file in the client's system | | clientFile | File name of the uploaded file in the client's system | | clientFileExt | Extension of the uploaded file in the client's system | | clientFileName | File name of the uploaded file without extension in the client's system | | contentSubtype | MIME content subtype of the file (e
- Looping Through Files
This document explains how to handle large files in Lucee more efficiently.
- Lucee Resources (Virtual File Systems)
Extend your file system with any virtual file system
- Set a Mapping (regular, component and custom tag mapping)
Set a regular Mapping Lucee allows to set directory mappings in your Application.cfc, this mappings are only valid for the current request.
cfs // Application.cfc component { this.mappings['/shop']=getDirectoryFromPath(getCurrentTemplatePath())&amp;&quot;shop&quot;; }
We define the mappings as a struct, where the key of the struct is the virtual path