UniqueFilename(prepend, ext)
Last updated September 20, 2004
Version: 2 | Requires: ColdFusion 5 | Library: FileSysLib
Description:
Creates a unique filename from a passed prefix, file extension and current date/time. Filename format: prepend_080701_023052.ext
Return Values:
Returns a string.
Example:
#uniquefilename('nws','xml')#
</CFOUTPUT>
Parameters:
| Name | Description | Required |
|---|---|---|
| prepend | Prefix for the filename. | Yes |
| ext | Extension to give the file. | Yes |
Full UDF Source:
<cfscript>
/**
* Creates a unique filename from a passed prefix, file extension and current date/time.
* Modified by RCamden, changed hh to HH, thanks to Nathan D. for idea.
*
* @param prepend Prefix for the filename. (Required)
* @param ext Extension to give the file. (Required)
* @return Returns a string.
* @author Joshua Miller (josh@joshuasmiller.com)
* @version 2, September 20, 2004
*/
function uniquefilename(prepend,ext)
{
Return "#prepend#_#dateformat(now(),"mmddyy")#_#timeformat(now(),"HHmmss")#.#ext#";
}
</cfscript>
Search CFLib.org
Latest Additions
Dave Anderson added
iniToStruct
20 day(s) ago
Dave Anderson added
deDupeArray
20 day(s) ago
Richard added
dice
22 day(s) ago
Isaac Dealey added
getRelative
a while ago
Top Rated
backupDatabase
Rated 5.0, 22 time(s)
indentXml
Rated 5.0, 10 time(s)
generateSsccAsn
Rated 5.0, 4 time(s)
highlightAndCrop
Rated 5.0, 4 time(s)