手机站
网通分站
电信主站
密 码:
用户名:
热门关键字:  虚拟主机  cn域名  asd  ddd  域名注册
当前位置 : 主页>程序设计>Java技术>列表

经过百般努力,终于用JSP写出FileUpload上传小程序

来源:互联网 作者:west263.com 时间:2008-02-23 点击:
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!

Reference: http://www.7880.com/Info/Article-42b729a0.html


经过百般努力
,终于可以写出一个自己的上传小程序了,其中以上面的url为标准写的,不过这个程序和新版本的commons-fileupload-1.0,存在不一样的地方,就是:

新的是:

void write(Java.io.File file)
A convenience method to write an uploaded item to disk.

而这里的是String!!!

多亏我还有一点java基础,,通过查找api

Constructor Summary

File(File parent, String child)
Creates a new
File instance from a parent abstract pathname and a child pathname string.

File(String pathname)
Creates a new
File instance by converting the given pathname string into an abstract pathname.

File(String parent, String child)
Creates a new
File instance from a parent pathname string and a child pathname string.

File(URI uri)
Creates a new
File instance by converting the given file: URI into an abstract pathname.

我修改了这句为两句:


File writeFile=new File("F:\\public",name);

fi.write(writeFile);

这样这个上传程序终于可以工作了!(一会有源代码,上传一个文件的)

还有这里的"" 都是""(输入法问题),如果粘贴过来要一个个修改,不知道怎么回事情,网上的代码总是有一点让人难以琢磨的错误而不能运行!所以网上的东西只能参考理解之后再自己写!


其它过程:

1. upload
B 端的上传

1)

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!

共4页: 上一页 1 [2] [3] [4] 下一页
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
用户名: 密码:
匿名
注册