Setting a Limit to the Maximum Size of an Upload

Joey C. joeyjwc at gmail.com
Mon Oct 24 16:25:01 EDT 2005


Here is a basic overview of the variables included there.

params = cgi.FieldStorage()
I accidentally made a mistake when typing what the "thefile" variable
is.
thefile = params["upfile"].file
"upfile" is the CGI field that contains the file that I'm uploading.
As you can see, the if statement just compares two values,
os.path.getsize(thefile) and conf["upmax"], a variable I set that is
designated as the maximum file size allowed.

I'm assuming that this is all the information you need.  I'm sorry for
not including it earlier; I was in a bit of a rush.  ^.^




More information about the Python-list mailing list