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) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Vidya Vidya wrote:> 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) >This will help: http://www.onemanwonder.com/actionview-helpers-numberhelper-number_to_human_size Cheers, Mohit. 10/31/2007 | 3:51 PM. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
May be file_name.size.kilobytes ? On Oct 31, 2550 BE, at 10:28, Vidya Vidya wrote:> > 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)--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Oct 31, 12:55 am, Damian Terentiev <threeeyedfish-de...-HPQIj1OAFZMvJsYlp49lxw@public.gmane.org> wrote:> May be file_name.size.kilobytes ? > > On Oct 31, 2550 BE, at 10:28, Vidya Vidya wrote: > > > > > 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)here''s another one http://blog.snowonrails.com/articles/2007/05/14/ruby%E4%B8%AD%E7%9A%84kernel-sprintf-ruby%E4%B8%AD%E5%AE%9E%E7%8E%B0%E4%BF%9D%E7%95%99%E5%B0%8F%E6%95%B0%E7%82%B9%E5%90%8E%E8%8B%A5%E5%B9%B2%E4%BD%8D%E5%B0%8F%E6%95%B0%E7%9A%84%E6%96%B9%E6%B3%95 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 10/31/07, Vidya Vidya <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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)Well what is "not working well" about number_to_human_size? Show us your code. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---