Here's overkill for your app, but this puts the "TB, GB, MB or KB values
after the appropriate number. (Remember there are 1024 x's in a y, not
1000.) Pass the number of bytes and the # of decimal places you want
into the function : 
ie; x = beautifyBytes(104050305, 2) 

function BeautifyBytes(bytes, places)
        select case true
                case bytes > 1099511627776
                        beautifyBytes =
formatnumber(bytes/1099511627776, places) & " TB"
                case bytes > 1073741824
                        beautifyBytes = formatnumber(bytes/1073741824,
places) & " GB"
                case bytes > 1048576
                        beautifyBytes = formatnumber(bytes/1048576,
places) & " MB"
                case bytes > 1024 'its in the mb range
                        beautifyBytes = formatnumber(bytes/1024, places)
& " KB"
                case else
                        beautifyBytes = bytes & " (bytes)"
        end select
end function


HTH,

-bill


-----Original Message-----
From: jake williamson [mailto:jake.williamson@;28design.com] 
Sent: Wednesday, November 06, 2002 1:09 PM
To: ActiveServerPages
Subject: showing file size in meg


hello!

got this real cool file system thing building at the moment for our 
clients to log in and download pdf proofs.

it's a real small cosmetic thing but i'd like to show the size in 
'finder' style. at the moment my code:

<% = objFile.Size %>

gives me:

1489493

if i do:

<% = objFile.Size / 1000 %>

to divide it into k i get:

1489.493

when what i really want is:

1.489

or preferably:

1.4

is this gonna be a complete pain or is it dead easy??

thanks out here lads and lass',

jake




---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to