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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display file size 1

Status
Not open for further replies.

EddieVenus

Technical User
Apr 8, 2002
176
US
i am displaying a file size, but it is displayed in bytes, and i would like to display it in MB, since they are all .avi files, and larger than 1MB. Is this doable? what about KB, is that possible too? I have this code
------------------------------------------------------
response.write &quot;<table border=&quot;&quot;1&quot;&quot; cellpadding=&quot;&quot;5&quot;&quot;>&quot;

For Each f1 in objFC
if instr(ucase(f1.Name), &quot;.AVI&quot;) then
encdname = server.URLEncode(f1.name)
urlname = Replace(encdname, &quot;+&quot;, &quot;%20&quot;)
response.write &quot;<tr><td>&quot; & &quot;<a href=&quot; & ojbFV & urlname & &quot;>&quot; & f1.name & &quot;</a>&quot; & &quot;</td><td>&quot; & f1.DateCreated & _
&quot;</td><td>&quot; & f1.Size & &quot;</td><td>&quot;
response.write &quot;</tr>&quot;

end if
Next

response.write &quot;</table>&quot;
------------------------------------------------------
and just want to know if fl.size can be represented in MB or in KB instead of just bytes. Thank you.
 
<%@ LANGUAGE = &quot;VBscript&quot;%>
<html>
<body>
<%dim i
i = Request.QueryString(&quot;n&quot;)
if len(i)>0 and isnumeric(i) then
Response.Write i & &quot; bytes<br>&quot;
Response.Write formatnumber(i/1024, 2) & &quot; Kb<br>&quot;
Response.Write formatnumber(i/1024/1024, 2) & &quot; Mb<br>&quot;
end if
%> </body>
</html> codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
excellent, that will work just fine. Thank you. I was hoping for something smaller, faster, more built in, but this works, and that is what i need, code that works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top