Yes, I see that now. I tried your method and it seemed to work fine
until I tried printing the filesize out.
def checkfilesize(thefile):
# Check the Size of the File
global filesize
thefile.seek(0,2)
filesize = thefile.tell()
thefile.seek(0)
print filesize
print conf[upmax]
Joey C. wrote:
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
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.
--
http://mail.python.org/mailman/listinfo/python-list
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
Oh, I'm sorry, I didn't understand what you meant at first.
Then I read your reply over again and noticed that you said that the
problem lied in os.path.getsize() when I tried to run it on the
contents of an open file.
I'll try the method you outlined now.
--
Hello,
I'm designing a small briefcase program that will allow me to quickly
upload, download, and delete files in a briefcase. The only real
things that I have left to do are to design a method for checking if
the file exists, preventing it from overwriting files from other
directories, and
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
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