I am building a file uploader that also shows the current progress, so I am trying to override the make_file method of the cgi.FieldStorage class, so that the current transferred data size can be logged. The problem is my method is not being called for some reason. Perhaps I misunderstood how this is supposed to work:
#!/usr/bin/env python
print "Content-Type: text/html\n"
import cgi
import cgitb; cgitb.enable()
class CustomFieldStorage(cgi.FieldStorage):
def make_file(self, binary=None):
print "make_file called"
form = CustomFieldStorage()
fileitem = form["file"]
Shouldn't the "make_file called" line be run?
Edit: apparently, it doesn't get called for very small files (< 1KB), but works for larger ones.