易截截图软件、单文件、免安装、纯绿色、仅160KB

IIS 7 python 2.6 cgi 文件上传问题

我每次上传的文件读到的数据都不正确。2M 的图片读得10多K 。。哪位大侠可以帮帮我啊。
#!D:\ProgrammerTools\python26\python.exe
#encoding=utf-8
import cgitb
import os

cgitb.enable()
import cgi,urllib, md5
print "Content-type: text/html"
print""
print """<?xml version="1.0" encoding="utf-8" ?>
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>asdsadas</title></head><body>"""
form = cgi.FieldStorage()
if form.has_key('file'):
  fileitem = form['file']
  if not fileitem.file:
  print "Error: not a file upload.<P>"
  else:
   
  datas=[]
  while True:
  data = fileitem.file.read(1024)
  if not data:
  break
  datas.append(data)
  for d in datas:
  file(cgi.escape(fileitem.filename).decode("utf-8"),'wb').write(d)
else:


相关问答:

Python 3 发布这么久了,是时候转移了么?

    RT,貌似Python之父也说如果你现在开始新的项目的话,最好是直接使用Python3,可是实际上大家使用得大部分还是2.5,估计用2.6的都不是很多,并且相对应的许多扩展都没有3对应的版本。
    ......

谁用过python 的mock 做unit test

如果一段代码

Python code:

#!/usr/bin/python2.5
from urllib2 import Request,urlopen,URLError
def check():
req = Request('http://www.google.com')
try:
res = urlopen(req).read()
......

初学PYTHON,大家主要用它来做什么

    刚接触,感觉功能比较强大,主要是粘合性好,可以有机结合其他语言。但不明白它主要应用于什么领域,主要做那方面的东东。开发ERP系统是否可行?
基本上什么都可以做

今天去看了一下,基本上什么 ......

ShareDevelop3.0建立Python项目运行时报错

之前我的电脑上安装了IronPython2.0,后安装ShareDevelop3.0,采用默认设置
我在ShareDevelop中建立了一个默认的Python的控制台或窗体项目,运行时报错如下:

调试器抛出异常System.IO.FileNotFoundException: ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号