B
Blaktyger
Helllo,
I'm trying to set up a web page where users can upload their pictures.
I wrote a python script witch allows users to preview the pictures
posted to the database. Problem is that under Mozilla Firefox, the
images are not displayed.
This is the script I wrote:
#!/usr/bin/python2.3
print 'Content-Type: text/html\n\n'
import blakHtml, sys, cgi, urllib
sys.stderr = sys.stdout
prevSt=cgi.FieldStorage()
1 if not prevSt.has_key('nbOfPic'):
2 print 'blah blah!'
3 else:
4 nbOfPic2=prevSt['nbOfPic'].value
5prevPg=blakHtml.HTMLDocument()
6 header=prevPg.htmlHeader('Picture Preview')
7 beginTable=prevPg.tableTag()
8 p=0
9 nbOfLine=0
10 addLine=' '
11 for picLinked in range(int(nbOfPic2)):
12 p=p+1
13 exec("""if not prevSt.has_key('pin_nb_%s'):
14 pass
15 else:
16 addLine=addLine +'<img border="0" src="
'+prevSt['pin_nb_%s'].value+'" 17 width="204" height="152">
'+prevSt['pin_nb_%s'].value
18 nbOfLine=nbOfLine+1
19 if nbOfLine==5:
20 nbOfLine=0
21 addLine=addLine+'<br>' """)%(p,p,p)
22 print header+addLine+prevPg.htmlFooter()
line 6 generates the web page title
the loop check for non-null cgi values and creates the corresponding
<img> tag
Link to webpage http://pythonboard.homelinux.com/cgi-bin/howManyPics.py
Thanks!
I'm trying to set up a web page where users can upload their pictures.
I wrote a python script witch allows users to preview the pictures
posted to the database. Problem is that under Mozilla Firefox, the
images are not displayed.
This is the script I wrote:
#!/usr/bin/python2.3
print 'Content-Type: text/html\n\n'
import blakHtml, sys, cgi, urllib
sys.stderr = sys.stdout
prevSt=cgi.FieldStorage()
1 if not prevSt.has_key('nbOfPic'):
2 print 'blah blah!'
3 else:
4 nbOfPic2=prevSt['nbOfPic'].value
5prevPg=blakHtml.HTMLDocument()
6 header=prevPg.htmlHeader('Picture Preview')
7 beginTable=prevPg.tableTag()
8 p=0
9 nbOfLine=0
10 addLine=' '
11 for picLinked in range(int(nbOfPic2)):
12 p=p+1
13 exec("""if not prevSt.has_key('pin_nb_%s'):
14 pass
15 else:
16 addLine=addLine +'<img border="0" src="
'+prevSt['pin_nb_%s'].value+'" 17 width="204" height="152">
'+prevSt['pin_nb_%s'].value
18 nbOfLine=nbOfLine+1
19 if nbOfLine==5:
20 nbOfLine=0
21 addLine=addLine+'<br>' """)%(p,p,p)
22 print header+addLine+prevPg.htmlFooter()
line 6 generates the web page title
the loop check for non-null cgi values and creates the corresponding
<img> tag
Link to webpage http://pythonboard.homelinux.com/cgi-bin/howManyPics.py
Thanks!