<%-- 文件名:do_upload.jsp 作 者:縱橫軟件制作中心雨亦奇(zhsoft88@sohu.com)--%><%@ page contentType="text/html; charset=gb2312" language="java" import="java.util.*,com.jspsmart.upload.*" errorPage="" %><html><head><title>文件上傳處理頁面</title><meta http-equiv="Content-Type" content="text/html; charset=gb2312"></head><body><% // 新建一個SmartUpload對象 SmartUpload su = new SmartUpload(); // 上傳初始化 su.initialize(pageContext); // 設定上傳限制 // 1.限制每個上傳文件的最大長度。 // su.setMaxFileSize(10000); // 2.限制總上傳數據的長度。 // su.setTotalMaxFileSize(20000); // 3.設定允許上傳的文件(通過擴展名限制),僅允許doc,txt文件。 // su.setAllowedFilesList("doc,txt"); // 4.設定禁止上傳的文件(通過擴展名限制),禁止上傳帶有exe,bat, jsp,htm,html擴展名的文件和沒有擴展名的文件。 // su.setDeniedFilesList("exe,bat,jsp,htm,html,,"); // 上傳文件 su.upload(); // 將上傳文件全部保存到指定目錄 int count = su.save("/upload"); out. |