⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 upload.cgi

📁 ajax框架原吗,dojo目前很流行的,希望大家多多学习啊
💻 CGI
字号:
#!/usr/bin/python# FROM: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/273844import cgiimport cgitb; cgitb.enable()import os, sysimport stringUPLOAD_DIR = "/tmp/upload/"form = cgi.FieldStorage()dbg = []def debug(dbgstr):	dbg.append(str(dbgstr))def save_uploaded_file(form_field, upload_dir):	global form	if not form.has_key(form_field): 		debug("didn't find it! (1)")		return	fileitem = form[form_field]	if not fileitem.file: 		debug(form.getvalue(form_field, ""))		debug(fileitem.__dict__)		debug("didn't find it! (2)")		return	fout = file(os.path.join(upload_dir, fileitem.filename), 'wb')	while 1:		chunk = fileitem.file.read(100000)		if not chunk: break		fout.write (chunk)	fout.close()retval = "false";fileFields = ""if form.has_key("fileFields"):	fval = str(form.getvalue("fileFields", ""))	fileFields = fval.split(",")	debug("'fileCount': '" + str(len(fileFields)) + "',")	for field in fileFields:		debug("'fileField' : '"+field + "',")		save_uploaded_file(str(field).strip(), UPLOAD_DIR)	retval = "true";debug("'retval': " + retval)print """Content-Type: text/html<html>	<head>	</head>	<body>	    <textarea style="width: 100%%; height: 100px;">{ %s }</textarea>	</body></html>""" % (string.join(dbg, "\n"))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -