免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2246 | 回复: 4
打印 上一主题 下一主题

如何用Kiarrigell上传图片? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2006-05-22 15:15 |只看该作者 |倒序浏览
看了Kiarrigell的DOME,没有看见这样的例子,
在网上搜索了一下,limodom老大提到,我没找到最终方案,
<html>
<head>
<title>Test</title>
</head><body>
<form action="test.py" enctype="multipart/form-data" method="post">
input name<input type="text" name="name"><br/>
input password<input type="password" name="password"><br/>
file upload<input type="file" name="file"><br/>
<input type="submit" name="ok"  value="Send"></form>
</body>
</html>

那么这里的test.py应该怎么写呢? 才用pih方式,
请帮忙解决,谢谢.

论坛徽章:
0
2 [报告]
发表于 2006-05-22 22:08 |只看该作者
也就是类似论坛里面从本机可以上传图片到服务器上的功能.
谢谢.

论坛徽章:
0
3 [报告]
发表于 2006-05-22 22:52 |只看该作者
demo里有这个例子呀。
http://pythonic.zoomquiet.org:9080/demo/tour/frame_tour_zh.htm

fileUpload.html

  1.     1 <html>
  2.     2 <body>
  3.     3 <FORM ENCTYPE="multipart/form-data" ACTION="fileUpload.py" METHOD=POST>
  4.     4
  5.     5 File to process: <INPUT NAME="myfile" TYPE="file">
  6.     6 <INPUT TYPE="submit" VALUE="Send File"> </form>
  7.     7 </body>
  8.     8 </html>
  9.     9
复制代码


fileUpload.py

  1.     1 """Copy the uploaded file on the script directory"""
  2.     2 import os
  3.     3 print "uploading file %s" %_myfile.filename
  4.     4
  5.     5 # uncomment the following lines to copy the uploaded file
  6.     6 # to the current directory
  7.     7 """
  8.     8 f = _myfile.file # file-like object
  9.     9 dest_name = os.path.basename(_myfile.filename)
  10.    10 out = open(dest_name,'wb')
  11.    11 # copy file
  12.    12 import shutil
  13.    13 shutil.copyfileobj(f,out)
  14.    14 out.close()
  15.    15 """
复制代码


别把名字拼错了哦,是Karrigell.
faint,兄弟啊...再追加点点,是DEMO不是DOME,是limodou不是limodom

[ 本帖最后由 loveddie 于 2006-5-22 23:06 编辑 ]

论坛徽章:
0
4 [报告]
发表于 2006-05-23 08:02 |只看该作者
对不起,犯了这么严重的错误,谢谢楼上的指出.

还要努力,争取在一个月内学会Karrigell,另一个月完成项目,谢谢兄弟帮忙.

论坛徽章:
0
5 [报告]
发表于 2006-05-23 08:05 |只看该作者
谢谢 loveddie 兄弟告诉了我一个好的karrigell教学网址
http://pythonic.zoomquiet.org:9080/demo/tour/frame_tour_zh.htm

我怎么那么粗心,以前没有发现呢?看来好要认真一点.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP