uploading binary files via cgi

André Gacon andre.gacon at gmx.de
Mon Mar 17 09:04:18 EST 2003


Hello,

I'm trying to write a cgi-script for uploading binary files.
I tried it with this script, but the content seems to be incomplete:

#! C:/Programme/Python/pythonw.exe

print "Content-Type: text/html"
print

import cgi

form = cgi.FieldStorage()
item = form["file"]

if item.file:
    data = item.file.read()
    print cgi.escape(data)

Has anybody an idea to read the file in binary mode?
data= item.file.read_binary() seems not to be a solution, right??


Thanks and sorry for the bad english!

-- 
+++ GMX - Mail, Messaging & more  http://www.gmx.net +++
Bitte lächeln! Fotogalerie online mit GMX ohne eigene Homepage!






More information about the Python-list mailing list