How to convert file size in KB/GB

Hi all,

I want to find the file size, so i used file_name.size, but while
displaying i want to show in KB or MB like this i want to show to show
the user, i tried number_to_human_size helper also, but this is also not
working well, so please let me know how to do, thanks,

my expected output is:

TransactionSets.JPG (141 KB)
Updates.JPG (121 KB)

Vidya V. wrote:

Updates.JPG (121 KB)

This will help:
http://www.onemanwonder.com/actionview-helpers-numberhelper-number_to_human_size

Cheers,
Mohit.
10/31/2007 | 3:51 PM.

May be file_name.size.kilobytes ?

On Oct 31, 12:55 am, Damian T. [email protected]
wrote:

show
the user, i tried number_to_human_size helper also, but this is
also not
working well, so please let me know how to do, thanks,

my expected output is:

TransactionSets.JPG (141 KB)
Updates.JPG (121 KB)

here’s another one
http://blog.snowonrails.com/articles/2007/05/14/ruby中的kernel-sprintf-ruby中实现保留小数点后若干位小数的方法

On 10/31/07, Vidya V. [email protected] wrote:

TransactionSets.JPG (141 KB)
Updates.JPG (121 KB)

Well what is “not working well” about number_to_human_size? Show us your
code.