<%@ page contentType="text/html; charset=gbk" language="java" import="com.jspsmart.upload.SmartUpload" errorPage="" %><HTML>
<BODY BGCOLOR='white'><H1>jspSmartUpload : Servlet Sample</H1>
<HR>
<%
request.setCharacterEncoding("gbk");
int count = 0;
SmartUpload mySmartUpload = new SmartUpload();
try {
mySmartUpload.initialize(config, request, response);
mySmartUpload.upload();
for (int i = 0; i < mySmartUpload.getFiles().getCount(); i++) {
com.jspsmart.upload.File myfile = mySmartUpload.getFiles().getFile(i);
String fileName = myfile.getFileName();
count = mySmartUpload.save("/upload");
/*myfile.saveAs("/upload/"+fileName);*/
}
out.println("other="+mySmartUpload.getRequest().getParameter("other"));
out.println(count + " file uploaded.");
} catch (Exception e) {
out.println("Unable to upload the file.<br>");
}
%>
</BODY>
<BODY BGCOLOR='white'><H1>jspSmartUpload : Servlet Sample</H1>
<HR>
<%
request.setCharacterEncoding("gbk");
int count = 0;
SmartUpload mySmartUpload = new SmartUpload();
try {
mySmartUpload.initialize(config, request, response);
mySmartUpload.upload();
for (int i = 0; i < mySmartUpload.getFiles().getCount(); i++) {
com.jspsmart.upload.File myfile = mySmartUpload.getFiles().getFile(i);
String fileName = myfile.getFileName();
count = mySmartUpload.save("/upload");
/*myfile.saveAs("/upload/"+fileName);*/
}
out.println("other="+mySmartUpload.getRequest().getParameter("other"));
out.println(count + " file uploaded.");
} catch (Exception e) {
out.println("Unable to upload the file.<br>");
}
%>
</BODY>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货