yes.

def filesize(filename):
   import os, stat
   return os.stat(os.path.join(request.folder,filename))
[stat.ST_MTIME]

db.define_table('mytable',
  Field('file','upload'),
  Field
('file_size','integer',readable=False,writable=False,compute=lambda r:
filesize(r['file'])))

On Jan 3, 7:10 pm, Alexandre <airm...@gmail.com> wrote:
> But I didnt want to query the size of the files every time I needed
> them, isnt there a way I can keep them on the db?
>
> Also, how to retrieve the original filename of the uploaded file?
>
> Thanks,
> Alexandre
>
> On 03/01/2010, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
>
>
> > def filesize(filename):
> >    import os, stat
> >    return os.stat(os.path.join(request.folder,filename))
> > [stat.ST_MTIME]
>
> > On Jan 3, 6:20 pm, Alexandre <airm...@gmail.com> wrote:
> >> Hi,
>
> >> I want to get the number of uploaded files and also the total size of
> >> them, how I do that? Can I assume all files are in the uploaded files?
>
> >> Also, I want to display the size of each individual file next to their
> >> name, how I do that?
>
> >> Thanks
>
> >> --
> >> Alexandre Rosenfeld
>
> >> Eng Comp 06 - USP São Carlos
> >> FoG -http://fog.icmc.usp.br
> >> IM Team - AIESEC @SC
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "web2py-users" group.
> > To post to this group, send email to web...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > web2py+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/web2py?hl=en.
>
> --
> Alexandre Rosenfeld
>
> Eng Comp 06 - USP São Carlos
> FoG -http://fog.icmc.usp.br
> IM Team - AIESEC

--

You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.


Reply via email to