railo-context.Component coldbox.system.core.util.FileUtils
This is a File Utilities CFC
Method Summary | |
---|---|
void
|
appendFile(any FileToSave, any FileContents, [string CharSet='utf-8'], [boolean CheckCharSetFlag='false'])
Facade to append to a file's content. |
string
|
checkCharSet(string charset)
Check a charset with valid CF char sets, if invalid, it returns the framework's default character set. |
void
|
createFile(String filename)
Create a new empty fileusing java. |
void
|
directoryCopy(string source, string destination)
Copies an entire source directory to a destination directory. |
void
|
directoryCreate(string path='', [string mode='755'])
Create a new directory. |
void
|
directoryNew(string path, string name)
Creates a new directory on the file system. |
void
|
directoryRemove(string path='', [boolean recurse='true'])
Remove an entire directory. |
void
|
directoryRename(string path, string name)
Renames a directory on the file system. |
boolean
|
fileCanRead(String Filename)
Check wether you can read a file. |
boolean
|
fileCanWrite(String Filename)
Check wether you can write to a file. |
string
|
fileLastModified(string filename)
Get the last modified date of a file. |
string
|
fileSize(string filename, [string sizeFormat='bytes'])
Get the filesize of a file. |
string
|
getAbsolutePath(string path)
Turn any system path, either relative or absolute, into a fully qualified one. |
string
|
getFileMimeType(string extension)
Get's the file mime type for a given file extension. |
boolean
|
isDirectory(String Filename)
Check wether the filename argument is a directory or not. |
boolean
|
isFile(String Filename)
Checks whether the filename argument is a file or not. |
any
|
readFile(String FileToRead, [boolean ReadInBinaryFlag='false'], [string CharSet='utf-8'], [boolean CheckCharSetFlag='false'])
Facade to Read a file's content. |
boolean
|
removeFile(string filename)
Remove a file using java. |
void
|
renameFile(string path, string name)
Renames a directory on the file system. |
string
|
ripExtension(string filename)
Rip the extension of a filename. |
void
|
saveFile(any FileToSave, any FileContents, [string CharSet='utf-8'], [boolean CheckCharSetFlag='false'])
Facade to save a file's content. |
void
|
sendFile([any file=''], [string name=''], [string mimeType=''], [string disposition='attachment'], [boolean abortAtEnd='false'], [string extension=''], [string deleteFile='false'])
Send a file to the browser. |
any
|
uploadFile(string fileField, string destination, [string nameConflict='makeunique'], [string accept=''], [string attributes='Normal'], [string mode='755'])
Facade to upload to a file, returns the cffile variable. |
Methods inherited from class railo-context.Component |
---|
None |
Method Detail |
---|
Facade to append to a file's content
FileToSave
- The absolute path to the file.FileContents
- The file contentsCharSet
- CF File CharSet Encoding to use.CheckCharSetFlag
- Check the charset.Check a charset with valid CF char sets, if invalid, it returns the framework's default character set
charset
- Charset to checkCreate a new empty fileusing java.io.File.
filename
- The absolute path of the file to create.Copies an entire source directory to a destination directory
source
destination
Create a new directory
path
- The full path to removemode
- The mode of the file for Unix systems, the default is 755Creates a new directory on the file system.
path
- The absolute path of the base directory. The new directory will be a sub-directory of this path.name
- The name of the new directory.Remove an entire directory
path
- The full path to removerecurse
- Recurse or notRenames a directory on the file system.
path
- The absolute path of the directory. This directory will be renamed to the name argument.name
- The new name of the directory.Check wether you can read a file
Filename
- The absolute path of the file to check.Check wether you can write to a file
Filename
- The absolute path of the file to check.Get the last modified date of a file
filename
Get the filesize of a file.
filename
sizeFormat
- Available formats: [bytes][kbytes][mbytes][gbytes]Turn any system path, either relative or absolute, into a fully qualified one
path
- Abstract pathnameGet's the file mime type for a given file extension
extension
- e.g. jpg or gifCheck wether the filename argument is a directory or not
Filename
- The absolute path of the file to check.Checks whether the filename argument is a file or not.
Filename
- The absolute path of the file to check.Facade to Read a file's content
FileToRead
- The absolute path to the file.ReadInBinaryFlag
- Read in binary flag.CharSet
- CF File CharSet Encoding to use.CheckCharSetFlag
- Check the charset.Remove a file using java.io.File
filename
- The absolute path to the file.Renames a directory on the file system.
path
- The absolute path of the file to renamename
- The new name of the file.Rip the extension of a filename.
filename
Facade to save a file's content
FileToSave
- The absolute path to the file.FileContents
- The file contentsCharSet
- CF File CharSet Encoding to use.CheckCharSetFlag
- Check the charset.Send a file to the browser
file
- The absolute path to the file or a binary filename
- The name to send the file to the browser. If not sent in, it will use the name of the file or a UUID for a binary filemimeType
- A valid mime type to use. If not sent in, we will try to use a default one according to file extensiondisposition
- The browser content disposition (attachment/inline)abortAtEnd
- Do an abort after content sendingextension
- Only used if file is binary. e.g. jpg or gifdeleteFile
- Delete the file after sending. Only used if file is not binaryFacade to upload to a file, returns the cffile variable.
fileField
- The name of the form field used to select the filedestination
- The absolute path to the destination.nameConflict
- Action to take if filename is the same as that of a file in the directory.accept
- Limits the MIME types to accept. Comma-delimited list.attributes
- Comma-delimitted list of window file attributesmode
- The mode of the file for Unix systems, the default is 755