Get the file size


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

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
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...
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lulu50Author Commented:

Thank you that's a great idea!!!!
lulu50Author Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.