Load file : File Upload : CGI Web PYTHON TUTORIALS


PYTHON TUTORIALS » CGI Web » File Upload »

 

Load file


import cgi
form = cgi.FieldStorage()
if not form:
    print "Content-Type: text/html"
    print
    print """
    <form action = "/uploadfiles.py" method="POST" enctype="multipart/form-data">
    <input type="file" name="filename">
    <input type="submit">
    </form>
    """
elif form.has_key("filename"):
    item = form["filename"]
    if item.file:
        data = item.file.read()
        print "Content-Type: text/html"
        print
        print cgi.escape(data)



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON TUTORIALS

 Navioo CGI Web
» File Upload