source: DataExtractor/trunk/dx-0.1.0/upload.py @ 70

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/DataExtractor/trunk/dx-0.1.0/upload.py@70
Revision 70, 926 bytes checked in by astephen, 16 years ago (diff)

Beta-release of dx: version 0.1.0

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1#!/home/tornado/internal/badc/software/development/cdat-4.0b3-ppio/linux/redhat7.3/bin/python
2
3import cgi
4
5
6form=cgi.FieldStorage()
7
8print "Content-Type: text/html\n\n"
9fileitem=None
10if form.has_key("myfile"): fileitem = form["myfile"]
11
12if fileitem and fileitem.file:
13    print "FILE!"
14    # It's an uploaded file; count lines
15    linecount = 0
16    while 1:
17        line = fileitem.file.readline()
18        if not line: break
19        linecount = linecount + 1
20        print "<P>lines:", linecount
21else:
22    print "<html><head></head><body>"
23    print '<H1>Upload Data File</H1>'
24    print '<FORM ACTION="http://cdat.badc.nerc.ac.uk/cgi-bin/extractor/upload.py" '
25    print '   METHOD="POST" ENCTYPE="multipart/form-data">'
26    print 'Data File to Upload: '
27    print '<BR><INPUT TYPE="file" NAME="myfile" SIZE="50">'
28    print '<BR><INPUT TYPE="submit" NAME="submit" Value="UPLOAD">'
29    print ' </FORM>'
30
31print "<body><html>"
Note: See TracBrowser for help on using the repository browser.