[Tutor] Help with CGI output

Sharriff Aina NHYTRO@compuserve.com
Thu, 22 Feb 2001 11:22:22 -0500


Thanks Alan!

I noticed  an hour ago the same mistakes, this is what it looks like now:=


######################################

#!C:/Python/python.exe -u

print "Content-Type: text/html\n\n"


import cgi
import os
#
os.chdir("c:\\Xitami\medintouch\images")
test2 =3D os.getcwd()
print "<html><head><title>test</title></head>"
print '<body>'
print "<br></br>"
print "<h3>Available images on server</h3>"
#print "<br></br>"
#print test2
print "<br></br>"
templist =3D os.listdir("c:\\Xitami\medintouch\images")
print '<table border=3D"1">'
for x in templist:
    print '<tr>'
    print '<td>'    =

    print x
    print '</td>'
    print '<td>'
    print '<img src=3D"'
    print '../images'
  # print os.getcwd() + '\\' + x
    print '/' + x
    print '"></td>'
    print '<td><input type=3D"button" value=3D"insert image"></input></td=
>'
    print '<tr>'
print '<tr><td>&nbsp</td></tr>'
print '<tr><td><input type=3D"submit" value=3D"insert image"></td></tr>'
print '</table>'
print '</body>'
print '</html>'
##### end of script #########

this works, although very dirty.. all I need now is someone to show me ho=
w
to write an upload script for the images..

Thanks for your reply Alan!

Regards

Sharriff

 =

I'm guessing here but...

> print "<html><title>test</title>"

Shouldn't there be <head></head> tags in there too?

> ....
>     print '<td><img src=3D"'
>     print '<img src=3D"'
>     print 'http://10.104.98.70/medintouch/images'
>     print '/' + x
>     print '"></td>'
Will output:

<td><img src=3D"
http://10.104.98.70/medintouch/images
/someXvalue
"></td>

I'm not sure whether breaking the url like that is a =

good idea, it might be better to build the whole img =

tag as a string then print it... but I don't do much =

CGI som maybe it won't matter.

>     print '<td><input type=3D"checkbox"></input></td>'

Won't that need to be inside a <form>,/form> pair to =

take effect?


Just some random thoughts!

Alan G




----------------------- Internet Header --------------------------------
Sender: alan.gauld@bt.com
Received: from gollum.axion.bt.co.uk (gollum.axion.bt.co.uk
[132.146.17.41])
        by spdmgaae.compuserve.com (8.9.3/8.9.3/SUN-1.9) with ESMTP id
LAA17615
        for <NHYTRO@compuserve.com>; Thu, 22 Feb 2001 11:09:35 -0500 (EST=
)
From: alan.gauld@bt.com
Received: from cbtlipnt02.btlabs.bt.co.uk by gollum (local) with ESMTP;
          Thu, 22 Feb 2001 16:04:14 +0000
Received: by cbtlipnt02.btlabs.bt.co.uk =

          with Internet Mail Service (5.5.2652.35) id <1PP7WPG5>;
          Thu, 22 Feb 2001 16:00:26 -0000
Message-ID:
<5104D4DBC598D211B5FE0000F8FE7EB20751D5BB@mbtlipnt02.btlabs.bt.co.uk>
To: NHYTRO@compuserve.com, tutor@python.org
Subject: RE: [Tutor] Help with CGI output
Date: Thu, 22 Feb 2001 16:00:13 -0000
X-Mailer: Internet Mail Service (5.5.2652.35)
MIME-version: 1.0
Content-type: text/plain; charset=3D"iso-8859-1"


 =

I'm guessing here but...

> print "<html><title>test</title>"

Shouldn't there be <head></head> tags in there too?

> ....
>     print '<td><img src=3D"'
>     print '<img src=3D"'
>     print 'http://10.104.98.70/medintouch/images'
>     print '/' + x
>     print '"></td>'
Will output:

<td><img src=3D"
http://10.104.98.70/medintouch/images
/someXvalue
"></td>

I'm not sure whether breaking the url like that is a =

good idea, it might be better to build the whole img =

tag as a string then print it... but I don't do much =

CGI som maybe it won't matter.

>     print '<td><input type=3D"checkbox"></input></td>'

Won't that need to be inside a <form>,/form> pair to =

take effect?


Just some random thoughts!

Alan G




----------------------- Internet Header --------------------------------
Sender: alan.gauld@bt.com
Received: from gollum.axion.bt.co.uk (gollum.axion.bt.co.uk
[132.146.17.41])
        by spdmgaae.compuserve.com (8.9.3/8.9.3/SUN-1.9) with ESMTP id
LAA17615
        for <NHYTRO@compuserve.com>; Thu, 22 Feb 2001 11:09:35 -0500 (EST=
)
From: alan.gauld@bt.com
Received: from cbtlipnt02.btlabs.bt.co.uk by gollum (local) with ESMTP;
          Thu, 22 Feb 2001 16:04:14 +0000
Received: by cbtlipnt02.btlabs.bt.co.uk =

          with Internet Mail Service (5.5.2652.35) id <1PP7WPG5>;
          Thu, 22 Feb 2001 16:00:26 -0000
Message-ID:
<5104D4DBC598D211B5FE0000F8FE7EB20751D5BB@mbtlipnt02.btlabs.bt.co.uk>
To: NHYTRO@compuserve.com, tutor@python.org
Subject: RE: [Tutor] Help with CGI output
Date: Thu, 22 Feb 2001 16:00:13 -0000
X-Mailer: Internet Mail Service (5.5.2652.35)
MIME-version: 1.0
Content-type: text/plain; charset=3D"iso-8859-1"



Message text written by INTERNET:alan.gauld@bt.com
> =

I'm guessing here but...

> print "<html><title>test</title>"

Shouldn't there be <head></head> tags in there too?

> ....
>     print '<td><img src=3D"'
>     print '<img src=3D"'
>     print 'http://10.104.98.70/medintouch/images'
>     print '/' + x
>     print '"></td>'
Will output:

<td><img src=3D"
http://10.104.98.70/medintouch/images
/someXvalue
"></td>

I'm not sure whether breaking the url like that is a =

good idea, it might be better to build the whole img =

tag as a string then print it... but I don't do much =

CGI som maybe it won't matter.

>     print '<td><input type=3D"checkbox"></input></td>'

Won't that need to be inside a <form>,/form> pair to =

take effect?


Just some random thoughts!

Alan G




----------------------- Internet Header --------------------------------
Sender: alan.gauld@bt.com
Received: from gollum.axion.bt.co.uk (gollum.axion.bt.co.uk
[132.146.17.41])
        by spdmgaae.compuserve.com (8.9.3/8.9.3/SUN-1.9) with ESMTP id
LAA17615
        for <NHYTRO@compuserve.com>; Thu, 22 Feb 2001 11:09:35 -0500 (EST=
)
From: alan.gauld@bt.com
Received: from cbtlipnt02.btlabs.bt.co.uk by gollum (local) with ESMTP;
          Thu, 22 Feb 2001 16:04:14 +0000
Received: by cbtlipnt02.btlabs.bt.co.uk =

          with Internet Mail Service (5.5.2652.35) id <1PP7WPG5>;
          Thu, 22 Feb 2001 16:00:26 -0000
Message-ID:
<5104D4DBC598D211B5FE0000F8FE7EB20751D5BB@mbtlipnt02.btlabs.bt.co.uk>
To: NHYTRO@compuserve.com, tutor@python.org
Subject: RE: [Tutor] Help with CGI output
Date: Thu, 22 Feb 2001 16:00:13 -0000
X-Mailer: Internet Mail Service (5.5.2652.35)
MIME-version: 1.0
Content-type: text/plain; charset=3D"iso-8859-1"

<