I have created upload script and worked great, but I don't know how do I check the size of the file before upload because I want to limited on 10mb per file...

So, mu question is: How do I check the size of the file before upload ?

Thanks...

Something like this?

>>> import os
>>> print os.listdir(".")
['DLLs', 'Doc', 'include', 'Lib', 'libs', 'LICENSE.txt', 'NEWS.txt', 'python.exe', 'pythonw.exe', 'README.txt', 'Scripts', 'tcl', 'Tools', 'unicows.dll', 'w9xpopen.exe']
>>> print os.path.getsize("readme.txt")
56189
>>> print (os.path.getsize("readme.txt")) < 10000000
True
>>>

Something like this?

>>> import os
>>> print os.listdir(".")
['DLLs', 'Doc', 'include', 'Lib', 'libs', 'LICENSE.txt', 'NEWS.txt', 'python.exe', 'pythonw.exe', 'README.txt', 'Scripts', 'tcl', 'Tools', 'unicows.dll', 'w9xpopen.exe']
>>> print os.path.getsize("readme.txt")
56189
>>> print (os.path.getsize("readme.txt")) < 10000000
True
>>>

Yes, I know about this, but this is if the file is in my computer.
My script is to enable fellows to upload files to me (I'm the server) and now I want to limited the upload on 10mb per file.

I tried with os.path.getsize(os.path.basename(fileitem.filename)) where "fileitem" is the uploaded file but I got the error "No such file or directory"...