UniqueFilename(prepend, ext)
Last updated September 20, 2004
Version: 2 | Requires: CF5 | 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:
<CFOUTPUT>
#uniquefilename('nws','xml')#
</CFOUTPUT>
Parameters:
Name | Description | Required |
---|---|---|
prepend | Prefix for the filename. | Yes |
ext | Extension to give the file. | Yes |
Full UDF Source:
/**
* 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#";
}
Search CFLib.org
Latest Additions
Raymond Camden added
QueryDeleteRows
November 04, 2017
Leigh added
nullPad
May 11, 2016
Raymond Camden added
stripHTML
May 10, 2016
Kevin Cotton added
date2ExcelDate
May 05, 2016
Raymond Camden added
CapFirst
April 25, 2016