PDA

View Full Version : HTTP.GetFileSize > convert to Mbyte format


KintaRo
06-04-2009, 05:47 AM
Hi. I used like these codes:

fSize = HTTP.GetFileSize("http://download.bleepingcomputer.com/sUBs/ComboFix.exe", MODE_BINARY, 20, 80, nil, nil, nil);
Dialog.Message("Bla Bla", "File size is: "..fSize.." Mbyte", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1)

This code gives file size: "3015597" but i want to give for Mbyte format( Like 2.9 MB). How can i do this?

Ulrich
06-04-2009, 08:07 AM
Hi,

String.GetFormattedSize(number, FMTSIZE_AUTOMATIC) does what you want. Check the help file for details...

Ulrich

KintaRo
06-04-2009, 09:22 AM
Thanks for your reply. I used your solution:

fSize = HTTP.GetFileSize("http://download.bleepingcomputer.com/sUBs/ComboFix.exe", MODE_BINARY, 20, 80, nil, nil, nil);
mbSize = String.GetFormattedSize(fSize, FMTSIZE_AUTOMATIC)
Dialog.Message("Bla Bla", "File size is: "..mbSize.." Proceed to download?", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1)

...and it's worked!

http://img188.imageshack.us/img188/2720/asdfssssssss.jpg

Thank you so much.