I'm having trouble using cffile right before I create a directory. I am using the cffileupload tag and my url attribute is a page that has the following code. Basically the code below creates a new directory and uploads all the images to that directory. However, it fails on the 2nd upload and i get a 500 error in the cffileupload flash object. However, if I hardcode the directory path, they all upload fine. Anyone know why I am having this problem?
<!--- User will upload all the images to a temp directory based on date and time --->
<cfset uploadFolderPath = "C:\ColdFusion9\wwwroot\MyApplication\uploads\" />
<cfset date=DateFormat(Now(),'mm-dd-yyyy_') />
<cfset time=TimeFormat(Now(),'hh-mm-ss') />
<cfset newFolderName = "upload_" & date & time />
<cfset newFolder = uploadFolderPath & newFolderName />
<cfdirectory action = "create" directory="#newFolder#" />
<cffile action="uploadall" destination="#newFolder#" nameconflict="makeunique" />
ok so I found out that the url path in cffileupload is called for each file being uploaded, so it was failing because the processing script was was trying to create an already existing directory from the previous file uploaded (which occurred during the same second). checking to see if the directory exists before creating it solved my problem.