file.initialize(pageContext);
file.upload();
String id=file.getRequest().request.getParameter("id");//该成这样
out.print(id);
out.close();%>
file.upload();
String id=file.getRequest().request.getParameter("id");//该成这样
out.print(id);
out.close();%>
解决方案 »
- java获取相对路径
- 求助SSH整合异常:java.lang.NullPointerException
- 我发现FCKeditor编辑器对中文支持不好,只有有限的几个中文字体。。。。。。。。。。。
- java链接mysql,jdbc驱动到底要如何配置啊
- 数据库连接问题,,,急
- 急!!!分页怎么实现???
- 如何限制非登陆用户通过URL访问图片?
- JSP新手问题
- java代码怎么生成GUID啊?有没有代码?急啊!!!!!
- 微信公众号开发当前页面的url未注册问题
- jdbc连接oracle8.1.7问题:Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNUM=135294976)(ERR=12505)(ERROR_STACK=(ERROR=(COD
- 用MediaPlayer连续播放歌曲
<%@ page contentType="text/html;charset=gb2312" %>接收:
<%=new String(Request.getParameter("name").getBytes("ISO8859_1"), "GB2312")%>
file.upload();
String id = file.getRequest().getParameter("id");
....
中文接收问题:
接受页面:
String param=java.net.URLDecoder.decode((String)request.getParameter(str));
=============
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*,com.jspsmart.upload.*" errorPage="" %>
<jsp:useBean id="file" scope="page" class="com.jspsmart.upload.SmartUpload" />
<jsp:useBean id="leidb" scope="page" class="db.linkmysql" />
<%
file.initialize(pageContext);
file.setTotalMaxFileSize(104857600);
file.setAllowedFilesList("doc,exe,txt,pdf");
try{
file.upload();
}
catch(Exception e){
out.println("<font color=red>上传失败</font> <a href=\"JavaScript:window.history.back();\">返回重试</a><br>");
out.println("<UI>错误信息:</UI>");
out.println("<UL>可能你的文件已经超过<font color=red>100MB</font>了.</UL>");
out.println("<UL>可能你的文件类型不对,仅允许上传<font color=red>doc,exe,txt,pdf</font>格式.</UL>");
//leidb.executeUpdate("DELETE FROM file WHERE id="+id);
return;
}
String id=file.getRequest().getParameter("a");
out.print(id);
out.close();
String name=request.getParameter("filename");
String extname=file.getFiles().getFile(1).getFileExt();
String type=file.getFiles().getFile(1).getTypeMIME();
String fullname="/jsp/files/" +name+"."+extname;
fullname=fullname.toLowerCase();
out.print(fullname);
//file.getFiles().getFile(1).saveAs(fullname);
//leidb.executeUpdate("UPDATE file SET url='"+fullname+"' WHERE id="+id);
%>