求一个smartupload实例 [email protected]要个完整点的例子,好用的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 jspsmartupload实例就行我自己写了一个不是很理想 给你个简单的吧。没有任何逻辑的!<form name="Formupdate" id="Formupdate" action="upload.jsp" method="post" enctype="multipart/form-data"> <td class="b23"><input type="File" name="importFile" size="30"></td></form> SmartUpload mySmartUpload = new SmartUpload(); // Initialization mySmartUpload.initialize(pageContext); // Upload mySmartUpload.upload(); if (mySmartUpload.getFiles().getCount() > 0) { // Retreive the current file com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0); // Save it only if this file exists if (!myFile.isMissing()) { // if fold not existed, auto create it java.io.File tempDir = new java.io.File("c:\\temp\\"); try { if (!tempDir.exists()) tempDir.mkdirs(); } catch (Exception e) { return; } // sample with a physical path fileName = "c:\\temp\\" + myFile.getFileName(); myFile.saveAs(fileName, mySmartUpload.SAVE_PHYSICAL); } else { logString=messageResource.getString("SpbmImport.MustChooseFile"); flagerror=true; } } else { return; }catch (Exception e) { out.println(e.getMessage()); e.printStackTrace(); try { con.rollback(); } catch (Exception sqle) { } } finally { try { con.close(); } catch (Exception sqle) { } } struts2 拦截器不跳转 求救 在线等 关于jsp的几个问题 SSH整合看看错误指点一下哪些包不支持 (新手提问)eclipse运行jsp页面是出现的错误? spring3 mvc关于注解 请问怎么提取一个字符串中的汉字啊? JAVA如何返回前一天,今天为Today="20090203",前一天为20090202 通过JSP调用JavaBean时显示错误的问题 如何使用jbuilder来进行jsp的开发! ajax表单验证的问题 JSP执行JAVA方法的问题 同一楼栋,多单元,多楼层,多楼房,要根据位置生成一个table,求助,谢谢。
<td class="b23"><input type="File" name="importFile" size="30"></td>
</form> SmartUpload mySmartUpload = new SmartUpload();
// Initialization
mySmartUpload.initialize(pageContext);
// Upload
mySmartUpload.upload();
if (mySmartUpload.getFiles().getCount() > 0) {
// Retreive the current file
com.jspsmart.upload.File myFile = mySmartUpload.getFiles().getFile(0);
// Save it only if this file exists
if (!myFile.isMissing()) {
// if fold not existed, auto create it
java.io.File tempDir = new java.io.File("c:\\temp\\");
try {
if (!tempDir.exists())
tempDir.mkdirs();
}
catch (Exception e) {
return;
}
// sample with a physical path
fileName = "c:\\temp\\" + myFile.getFileName();
myFile.saveAs(fileName, mySmartUpload.SAVE_PHYSICAL);
}
else {
logString=messageResource.getString("SpbmImport.MustChooseFile");
flagerror=true;
}
}
else {
return;
}catch (Exception e) {
out.println(e.getMessage());
e.printStackTrace();
try {
con.rollback();
}
catch (Exception sqle) {
}
}
finally {
try {
con.close();
}
catch (Exception sqle) {
}
}