Question
Looping over cfdirectory
Hello. I am having an issue with looping over cfdirectory.
What I am trying to do here is grab the size of the files
associated with the db. So where #current.Dir.Name# = #DB Column#
update size etc.... What's happening is it is displaying the same
id about 90 something times...Nice I know. Can anyone help?
<cfloop query="qLoadFile">
<cfoutput>
<cfdirectory directory="/test1/test2/test3/0/#qLoadFile.owner_id#" action="list" name="currentDir">
#qLoadFile.owner_id# <!--- This does display my ids correctly if I end the loop here but does not display anything in my table if I end the loop here and reopen it--->
</cfoutput>
<table border="1" bordercolor="#000000" >
<tr>
<td>File Name</td>
<td>File Size</td>
<td>Directory Location</td>
<td>File Type</td>
</tr>
<cfloop query="currentDir">
<tr>
<cfoutput>
<form name="updateSize" action=" http://myURL.com/test2.cfm" method="post">
<td><input type="text" name="name" value="#currentDir.Name#" /></td>
<td><input type="text" name="size" value="#currentDir.Size#" /></td>
<td>#right(currentDir.DIRECTORY, 2)#</td>
<td>#currentDir.Type#</td>
</cfoutput>
</tr>
</cfloop>
</cfloop>
</table> <br />
<input type="text" name="number_of_directories" value="<cfoutput>#valuelist(qLoadFile.owner_id)#</cfoutput>">
<input type="submit" name="submit" value="submit"/>
</form>
<cfloop query="qLoadFile">
<cfoutput>
<cfdirectory directory="/test1/test2/test3/0/#qLoadFile.owner_id#" action="list" name="currentDir">
#qLoadFile.owner_id# <!--- This does display my ids correctly if I end the loop here but does not display anything in my table if I end the loop here and reopen it--->
</cfoutput>
<table border="1" bordercolor="#000000" >
<tr>
<td>File Name</td>
<td>File Size</td>
<td>Directory Location</td>
<td>File Type</td>
</tr>
<cfloop query="currentDir">
<tr>
<cfoutput>
<form name="updateSize" action=" http://myURL.com/test2.cfm" method="post">
<td><input type="text" name="name" value="#currentDir.Name#" /></td>
<td><input type="text" name="size" value="#currentDir.Size#" /></td>
<td>#right(currentDir.DIRECTORY, 2)#</td>
<td>#currentDir.Type#</td>
</cfoutput>
</tr>
</cfloop>
</cfloop>
</table> <br />
<input type="text" name="number_of_directories" value="<cfoutput>#valuelist(qLoadFile.owner_id)#</cfoutput>">
<input type="submit" name="submit" value="submit"/>
</form>
