FileMgr.cfc
FileMgr.cfc helps to manage file locations and ensure all folders for storing files exist.
To initialize FileMgr, use the following code (Where "UploadPath" is a variable with the server path to the folder in which you want to store all of your uploaded files and "UploadURL" is the browser URL to the same folder.):
Application.FileMgr = CreateObject("component","FileMgr").init(UploadPath,UploadURL)
The following methods are the most commonly used in FileMgr:
- deleteFile(FileName,Folder)
- Deletes the file.
- getDirectory(Folder)
- Gets the full system path for the given folder.
- getFileLen(FileName,Folder)
- Gets the length file.
- getFilePath(FileName,Folder)
- Gets the full system path for the given file.
- getFileURL(FileName,Folder)
- Gets URL for the given file (if UploadURL was passed in to init).
- makeFolder(Folder)
- Makes the given folder, if it doesn't already exists.
- readFile(FileName,Folder)
- Returns the contents of the file.
- uploadFile(FieldName,Folder[,NameConflict])
- Uploads the file (tied to a Form).
- writeFile(FileName,Contents,Folder)
- Write the contents to the file.
CFC Docs
Blog Entries