upload file using cgi on Win2k IIS

Jason McWilliams jmcwill at tridog.com
Thu Oct 11 15:11:11 EDT 2001


Ignacio Vazquez-Abrams wrote:
> 
> On Thu, 11 Oct 2001, Jeff Shannon wrote:
> 
> > Jason McWilliams wrote:
> >
> > >
> > > Here is something interesting.  I can upload .txt and .doc files no
> > > problem,
> > > no matter what the size.  Things die when trying to upload .gif or .zip
> > > or .tgz
> > > or other binaries similar.  Some of it gets uploaded, but only a small
> > > portion?
> > >
> > > I am at a loss now.
> >
> > A wild guess--is it possible that the binary files have an embedded EOF-character?
> > IIS (or Windows) could conceivably see that embedded character and decide that it is
> > indeed at the end of file, even though there's more data in the real file....
> 
> The odd thing is that the file should be base64-encoded before it's sent to
> the server, so it NULLs and EOFs shouldn't be visible to the server.
> 
> Jason, instead of importing cgi.py, write the raw data from sys.stdin to a
> file and check to see if that's the case.


Turns out that I didnt have windows handling Python scripts with the -u
arg... to handle binary data unbuffered.  This fixed the problem by
setting .py files to use python -u %s %s on IIS.  (thanks to another
person on the list!)

Although, I am trying to Freeze the program into a .exe file.  In that
case it acts the same as before.  Not sure how to get freeze to do the
same as python -u.

Thanks for the help!


> 
> --
> Ignacio Vazquez-Abrams  <ignacio at openservices.net>
> 
>    "As far as I can tell / It doesn't matter who you are /
>     If you can believe there's something worth fighting for."
>        - "Parade", Garbage
> 
> --
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list