[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Get the file size

Posted on 2014-07-24
Medium Priority
Last Modified: 2014-07-24

I have a file stored in the database that I need to get the size of it.

How can I do that?

 <cfquery name = "QRmvLgFiles"  datasource='#strDSN#' username='#strUID#' password='#strPWD#'>
   Select FileID, Description, UploadedFile, Uploadedasbinary from Files
   where IssueID = #AlertIssueId#

   <cfloop query="QRmvLgFiles">

//here I need to find out what is the file size for the objects that I uploaded. 

Open in new window

Question by:lulu50
  • 2
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 40216872
I presume you refer to this field:

which is a binary field, likely.
you could simply get the binary field size by the relevant database function.
you can check the technical documentation of your rdbms, or tell us which db type you are using.
usualy it's a function with LEN, LENGTH in the name, or LENB for length in bytes...
LVL 39

Accepted Solution

gdemaria earned 2000 total points
ID: 40217124
What database are you using and what is the data type of the column

In the future, I suggest adding a field to your table for FileSize, then when you upload a new file, you can save the size of the file very easily.   To get the size of the file during upload, just use   CFFILE.FileSize  and save it.     This will allow you to query for the largest files or tell a user their total file size very easily.

Author Comment

ID: 40217474

Thank you that's a great idea!!!!

Author Closing Comment

ID: 40217475

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, I was working on some optimization and spam-stopping techniques when I encountered Ben Nadel's post to reduce spam feature using Math (http://www.bennadel.com/blog/197-How-I-Stop-Spammers-On-My-ColdFusion-Blog.htm). While this method is not o…
Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month19 days, 14 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question