Copy link to clipboard
Copied
<cfset time = #DateFormat(now(), "mm/dd/yyyy hh:mm:ss")#>
<cfset ufile = #FORM.name#>
<cfset final = ufile&""&time>
<cffile action="RENAME" source="#ExpandPath('..\original\#filename#')#" destination= "#ExpandPath('..#final#.txt')#">
I am trying to rename file dynamically with using time and name from form but it not working
Copy link to clipboard
Copied
Perhaps something like this?
<cfset date = dateFormat(now(), "mm_dd_yyyy")>
<cfset time = timeFormat(now(), "hh_mm_ss")>
<cfset datetime = date & "_" & time>
<cfset ufile = FORM.name>
<cfset final = ufile & "" & datetime & ".txt">
<cffile action="RENAME" source="#ExpandPath('..\original\#filename#')#" destination= "#ExpandPath('..\original\#final#')#">
Copy link to clipboard
Copied
I am trying to rename file dynamically with using time and name from form but it not working
What do you mean by "not working"?
<cffile action="RENAME" source="#ExpandPath('..\original\#filename#')#" destination= "#ExpandPath('..#final#.txt')#">
Do the source and destintations resolve to the values you expect them to? Your destination path doesn't look right to me.
--
Adam