相信自己!

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  26 随笔 :: 3 文章 :: 13 评论 :: 0 Trackbacks
<%@ page contentType="text/html;charset=gb2312" %> <%@ page language=" java" import="com.jspsmart.upload.*"%>

jspSmartUpload : Sample 3


<% // Variables int count=0; // Initialization mySmartUpload.initialize(pageContext); // Only allow txt or htm files //mySmartUpload.setAllowedFilesList("htm,html,txt,,"); // DeniedFilesList can also be used : // mySmartUpload.setDeniedFilesList("exe,bat,jsp"); // Deny physical path // mySmartUpload.setDenyPhysicalPath(true); // Only allow files smaller than 50000 bytes // mySmartUpload.setMaxFileSize(50000); // Deny upload if the total fila size is greater than 200000 bytes // mySmartUpload.setTotalMaxFileSize(200000); // Upload mySmartUpload.upload(); // Save the files with their original names in a virtual path of the web server try { count = mySmartUpload.save("/pic/upload/news", mySmartUpload.SAVE_VIRTUAL); String title=mySmartUpload.getRequest().getParameter("title"); String content=mySmartUpload.getRequest().getParameter("content"); String picture=mySmartUpload.getFiles().getFile(0).getFileName(); inewBean.insert_news(title,content,picture); } catch (Exception e){ out.println("Wrong selection : " + e.toString()); } // Display the number of files uploaded out.println(count + " file(s) uploaded."); %>
posted on 2007-12-05 13:12 北极雪 阅读(245) 评论(0)  编辑  收藏 所属分类: 网上转载

只有注册用户登录后才能发表评论。


网站导航: