Still no use. Python still hangs. [ was : file upload problem ]
Sindh
skodela at my-deja.com
Mon Aug 28 05:07:51 EDT 2000
Hi folks
I tried both methods found in cgiupload.py. It still does not work for
me. My setup is :
[1] In the html file with form the header is like
<form method="post" action="cgi-bin/odyssey.py" name="mainform"
enctype="multipart/form-data">
[2] the part of form sending files is like following :
<input type="file" name="file1">
<input type="file" name="file2"> ...
[3] The cgi script has a section like
def fup(x):
if fs.has_key(x):
fname=fs[x]
if fname.file:
if fname.filename:
fnumber=util.getcounter()
fnamelst=string.split(fname.filename,'.')
fout=imgroot+str(fnumber)+'.'+fnamelst[len(fnamelst)-1]
print fout
sys.stderr.write("hello thereeeeeeeeeeee")
f=open(fout,"wb")
while 1:
line=fs[x].file.readline()
if line:
f.write(line)
else:
break
f.close()
return fout
I also tried f.write(fs[x].value)
Every time , if this is a text mode file it writes without any problem.
If this is a image/binary mode , it hangs. The apache error log does not
have any entries in it. After a long time netscape closes the connection
complaining that it has timedout. At that time cgi script writes the
image / binary file but it is always 4 bytes long.
Can any of you make any sense of this whole mess. If you would like the
whole script I would mail it to you. My email it skodela at hotmail.com
Thanks
sreekant
--
A man needs to sleep for 36 hours a day atleast.
Sent via Deja.com http://www.deja.com/
Before you buy.
More information about the Python-list
mailing list