Setting a Limit to the Maximum Size of an Upload

Fredrik Lundh fredrik at pythonware.com
Tue Oct 25 05:33:54 EDT 2005


"Joey C." wrote:

> I'm afraid on my interpreter, this works.
>
>>>> if os.path.getsize("C:\\Documents and Settings\\Joey\\Desktop\\file.txt") <= 1000:
>>>> print "<= 1000."
>
> <= 1000.
>
> No problems there, as you can see.

I'm not sure if you replied to my post, but what I tried to say is that

    params["upfile"].file

doesn't return a string, it returns a file object.  and os.path.getsize
on something that's not a string gives the TypeError you're seeing.

</F> 






More information about the Python-list mailing list