您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

JspsmartUpload上传文件(2)

2024/4/1 12:00:02发布16次查看
jspsmart2.jsp %@ page import=com.jspsmart.upload.* % %@ page contenttype=text/html;charset=gb2312 % html head titlejspsmart2.jsp/title /head body h2文件上传范例 - jspsmart/h2 jsp:usebean id=mysmartupload scope=page class=com.jspsmart.uploa
jspsmart2.jsp
jspsmart2.jsp
文件上传范例 - jspsmart
//计算文件上传个数
int count=0;
//smartupload的初始化,使用这个jspsmart一定要在一开始就这样声明
mysmartupload.initialize(pagecontext);
//依据form的内容上传
mysmartupload.upload();
//将上传的文件一个一个取出来处理
for (int i=0;i{
       //取出一个文件
       com.jspsmart.upload.file myfile = mysmartupload.getfiles().getfile(i);
//如果文件存在,则做存档操作
       if (!myfile.ismissing()) {
//将文件存放于绝对路径的位置
           myfile.saveas(d://totalexample//jsp//uploadfile// + myfile.getfilename(), mysmartupload.save_physical);
//显示此上传文件的详细信息
           out.println(fieldname = + myfile.getfieldname() +
);
           out.println(size = + myfile.getsize() +
);
           out.println(filename = + myfile.getfilename() +
);
           out.println(fileext = + myfile.getfileext() +
);
           out.println(filepathname = + myfile.getfilepathname() +
);
           out.println(contenttype = + myfile.getcontenttype() +
);
           out.println(contentdisp = + myfile.getcontentdisp() +
);
           out.println(typemime = + myfile.gettypemime() +
);
           out.println(subtypemime = + myfile.getsubtypemime() +
);
           count ++;
       }
}
// 显示应该上传的文件数目
out.println(
+ mysmartupload.getfiles().getcount() + files could be uploaded.
);
// 显示成功上传的文件数目
out.println(count + file(s) uploaded.);
%>
注意事项:
一般输入类型(例如,text、password、select,等等)传送form到服务器端时,所用的编码方式是application/x-www-form-urlencoded,但是若要传送文件至服务器端时,必须使用mutilpart/form-data的编码方式;
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product