Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Return File Size of File

Status
Not open for further replies.

RSedlacek

Programmer
Oct 5, 1998
59
US
Is there a way to return the size of a file in a specific directory on a site using CF?

I have a folder with various files that users can download from my site. I want to be able to show the users the file size before they decide to download it.
 
If you are using CF8, use the GetFileInfo function.

For MX7 or earlier, use cfdirectory. You can use a filter to restrict the results to a specific file.


Code:
<cfdirectory directory="c:\someFolder\" filter="YourFileName.xls" name="fileDetails">
<!--- show file size --->
<cfoutput>File size in bytes: #fileDetails.size#</cfoutput>
<!--- show all --->
<cfdump var="#fileDetails#">

----------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top