方法如下:
//例項化 上載bean
com.jspsmart.upload.SmartUpload su = new com.jspsmart.upload.SmartUpload();
//初始化
su.initialize(pageContext);
//設定上載 的最大值
su.setMaxFileSize(1024*1024);//1MB
//上載檔案
su.upload();
com.jspsmart.upload.File file = su.getFiles().getFile(0);
//取附加資訊
String userName = su.getRequest().getParameter("UserName");
Uploader up = new Uploader(pageContext,request);
up.SaveFile(file);
out.write(up.GetFilePathRel());
%>
方法如下:
//例項化 上載bean
com.jspsmart.upload.SmartUpload su = new com.jspsmart.upload.SmartUpload();
//初始化
su.initialize(pageContext);
//設定上載 的最大值
su.setMaxFileSize(1024*1024);//1MB
//上載檔案
su.upload();
com.jspsmart.upload.File file = su.getFiles().getFile(0);
//取附加資訊
String userName = su.getRequest().getParameter("UserName");
Uploader up = new Uploader(pageContext,request);
up.SaveFile(file);
out.write(up.GetFilePathRel());
%>