我有从用户系统上载图像文件的代码,但在服务器端,上载的图像不显示,当我尝试手动打开时,它显示不支持文件格式
这是HTML代码
DICON Employee FormFile:
下面是cgi python脚本
#!c:\Python27\python.exe
import cgi
import cgitb
import os
import MySQLdb
cgitb.enable()
form = cgi.FieldStorage()
if not form.has_key("EmployeeID"):
print "Location: /DICON_FORM.html\n"
else:
print """Content-type: text/html
FORMemployeeID = form["EmployeeID"].value
firstName = form["FirstName"].value
lastName = form["LastName"].value
others = form["Others"].value
fileitem = form["filename"]
fn = ""
if fileitem.filename:
fn = os.path.basename(fileitem.filename)
open(fn, 'wb').write(fileitem.file.read())
print "