Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset
Comments Off

CGI: Uploader un fichier

 fichier, html
{filelink=16696}

#!c:/Python32/python
 
import cgi
import sys
 
def gen_html_header() :
    print "Content-Type: text/html"
    print "<HTML>"
 
def gen_html_trailer() :
    print "</HTML>"
gen_html_header()
form = cgi.FieldStorage()
try :
    file_contents = form["file"].value
    print file_contents
except :
    print sys.exc_info()
 
gen_html_trailer()
 
# Le Formulaire HTML
"""
 
<HTML>
 
<FORM ACTION="cgi-bin/upload.py" METHOD="POST" enctype="multipart/form-data">
<input type="hidden" name="user" value="me">
<input type="hidden" name="action" value="upload">
    <BR><I>Fichier:</I> <INPUT TYPE="FILE" NAME=file>
 
<input type="submit" value="Envoyer le Fichier">
</form>
 
</HTML>
 
"""

Livres Sur ce Sujet

----------------------------------------------------------------------------

Comments are closed.