<cfset application.documentsDirectory = "C:\Inetpub\wwwroot\Intranet\uploadfiles\">
<cfset application.documentsDirUrl = "http://localhost/Intranet/uploadfiles/">
<!--- Get Directory Contents --->
<cfdirectory directory="#application.documentsDirectory#" name="documentsDirectory" sort="size ASC, name DESC, datelastmodified">
<!--- This checks for the existence of at least 1 file within the directory and if true loops through the list of files and outputs each filename with a linking url. There are many more options available for reading the type of file - it's size etc... using the cfdirectory and cffile tags but you'll have to look in the reference pdf for more information --->
<cfif IsDefined("documentsDirectory") and documentsDirectory.RecordCount gt 0>
<cfloop query="documentsDirectory">
<cfif documentsDirectory.size lt 1025>
<cfset document_size = documentsDirectory.size>
<cfset size_type = "bytes">
<cfelseif documentsDirectory.size gt 1024 and documentsDirectory.size lt 1048577>
<cfset document_size = documentsDirectory.size/1024>
<cfset size_type = "Kb">
<cfelse>
<cfset document_size = documentsDirectory.size/1048576>
<cfset size_type = "Mb">
</cfif>
<cfoutput>
<a href="#application.documentsDirUrl#/#documentsDirectory.name#">#documentsDirectory.name#</a> #NumberFormat(document_size,"___,___")# #size_type#</cfoutput><br />
</cfloop>
</cfif>
|