File Uploads

Tim Roberts timr at probo.com
Wed Mar 30 03:17:57 EST 2005


"Doug Helm" <dhelm at wcsoftware.com> wrote:

>Hey, Folks:
>
>I'm trying to write a very simple file upload CGI.  I'm on a Windows server.
>I *am* using the -u switch to start Python for CGIs, as follows:
>
>c:\python\python.exe -u %s %s
>
>I *do* have write permissions on the directory I'm trying to write to.  But,
>when I click submit, it just hangs.  Any help would be greatly appreciated.
>Thanks.  Here's the code...
>
>Upload.py
>
>import cgi
>
>print "content-type: text/html\n\n"

I see you got your problem solved, but you should know there is a problem
with this line.  The print statement automatically adds an end-of-line, so
this will actually end up producing TWO blank lines after the header.  You
should use this:

    print "Content-type: text/html\n"
-- 
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list