Setting a Limit to the Maximum Size of an Upload

Fredrik Lundh fredrik at pythonware.com
Mon Oct 24 06:02:17 EDT 2005


"Joey C." wrote:

> thefile = params["upfile.file"]
> if os.path.getsize(thefile) <= conf["upmax"]:
>    print "File Size Okay."     #Add Functions Later...
> else:
>    print "File Too Large."     #Here, too.
>
> CGItb reported the following error:
> TypeError: coercing to Unicode: need string or buffer, instance found
>      args = ('coercing to Unicode: need string or buffer, instance
> found',)

cgitb probably also reported what line you got that error for, and the values
of the variables involved.  can you perhaps post that information too?

</F> 






More information about the Python-list mailing list