首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

JSP盛传文件出错求原因

2014-04-27 
JSP长传文件出错求原因

JSP长传文件出错求原因
<%@ page contentType="text/html" pageEncoding="GBK"%>
<%@ page import="org.lxh.smart.*"%>
<%@ page import="cn.mldn.lxh.util.*"%>
<html>
<head><title>www.mldnjava.cn,MLDN高端Java培训</title></head>
<body>
<%
request.setCharacterEncoding("GBK") ;
%>
<%
SmartUpload smart = new SmartUpload() ;
smart.initialize(pageContext) ;// 初始化上传操作
smart.upload() ;// 上传准备
String name = smart.getRequest().getParameter("uname") ;
IPTimeStamp its = new IPTimeStamp(request.getRemoteAddr()) ;// 取得客户端的IP地址
String ext = smart.getFiles().getFile(0).getFileExt() ;// 扩展名称
String fileName = its.getIPTimeRand() + "." + ext ;
smart.getFiles().getFile(0).saveAs(this.getServletContext().getRealPath("/")+"upload"+java.io.File.separator + fileName) ;
%>
<%=smart.getFiles().getFile(0).getFileName().matches("^JSP盛传文件出错求原因\\w+.(jpg|gif)$")%>
<h2>姓名:<%=name%></h2>
<img src="../upload/<%=fileName%>">
</body>
</html>
[解决办法]
敲不靠谱。拷贝、复制

热点排行