[Tutor] Python CGI-HTML editor

Glen Wheeler wheelege@tsn.cc
Tue, 8 May 2001 21:06:29 +1000


>I have coded an HTML online editor with the help of several Python CGI
>scripts. I´m now faced woth the problem of image insertion, I know how to
>upload files per CGI-Python to a server, but I still have 1 complicated
>hurdle:
>
>1. Is it possilbe to start a file upload AND send text data from a HTML
>form at the same time?

  Well, I don't know if anybody else has answered you yet, but you could
take a look at threading.  Something like...

import thread
<code>
def UploadStuff(file, form, server):
    thread.start_new_thread(UploadFile, (file, server))
    thread.start_new_thread(UploadForm, (form, server))
def UploadFile(file, server):
    <upload file to server...>
def UploadForm(file, server):
    <upload form to server...>

  As you can probably tell, I am not fluent in CGI - yet.  But I think this
should work if the server supports multiple connections from the same IP
address.

  Hope that helps,
  Glen.