I inherited some order entry websites that have worked seemingly flawlessly for the past 3 years. Today I learned that 3 files didn't get sent to a customer last week, and I can confirm these files they should have gotten were never created on the server. However, I can find no entry in any of the log files (C:\ColdFusion11\cfusion\logs) that would indicate what the issue was. I would have expected some kind of exception to occur if a file could not be created or is that not that case? This part of the code does not contain any cftry / cfcatch blocks. I'll include the relevant parts here:
<cfset OrderPath = #GetTempDirectory()#>
<cfset DateTime = DateFormat(now(),"yyyymmdd") & "_" & TimeFormat(now(),"hhmmssllll")>
<cfset OrderFileName = ("WB" & "_" & #DateTime# & ".ORD")>
<!--- Check if order file exists - if so, delete it --->
<cfif FileExists(#GetTempDirectory()#&#OrderFileName#)>
<cffile action="delete" file="#GetTempDirectory()##OrderFileName#">
</cfif>
<cfset HeaderRec ="H#x2tab##x2Cust##x2tab##x2OrdDate##x2tab##x2ContactName##x2tab##x2PO##x2tab##x2SubTotal ##x2tab##x2PST##x2tab##x2GSTHST##x2tab##x2Total##x2tab##x2Comments##x2tab##x2ShipToAddr1## x2tab##x2ShipToAddr2##x2tab##x2ShipToCity##x2tab##x2ShipToProvince##x2tab##x2ShipToCountry ##x2tab##x2ShipToPostal##x2tab##x2ShipToDate#"> <!--- I didn't include all those cfsets but if nothing else the first H would always be written, right? --->
<!--- Write Header record to file --->
<cffile action="write"
file="#GetTempDirectory()##OrderFileName#"
output="#HeaderRec#">
<cfloop from="1" to="#ArrayLen(Session.Cart.ItemID)#" index="ThisItem">
<cfset DetailRec ="D#x2tab##x2Item##x2tab##x2Qty##x2tab##x2Price##x2tab##x2Mask##x2tab##x2UOM##x2tab##x2Pr iceOver#"> <!--- similar to the HeaderRec --->
<!--- Write Detail record to file --->
<cffile action="append"
file="#GetTempDirectory()##OrderFileName#"
output="#DetailRec#">
</cfloop>
<cfset source = trim(#OrderPath#) & trim(#OrderFileName#)>
<cfset dest = trim(#Session.ftpdataoutdir#)>
<cffile action="copy" source="#source#" destination="#dest#">
<cflocation url="thankyou.htm" addtoken="no">
The thankyou.htm page includes an email order confirmation which they did receive so nothing prevented the page from processing all the way to the end. However, going to C:\ColdFusion11\cfusion\runtime\work\Catalina\localhost\tmp, which is where all of our files are written initially, these few files don't exist while hundreds of others that continue to be written there. How can I tell why these 3 files were not written so I can prevent it in the future?