Buffered" value="0">
86. name="ParentDoubleBuffered" value="0">
87. name="UseDockManager" value="0">
88. name="Enabled" value="-1">
89. name="AlignWithMargins" value="0">
90. name="ParentCustomHint" value="-1">
91. name="key1" value="">
92. name="key2" value="">
93. 94. 95. 96.
Java 代码 1. <%@ page contentType="text/html; charset=utf-8" language="java" import="java.
sql.*,java.io.*" errorPage="" %> 2. <% 3. String savePath=config.getServletContext().getRealPath("/")+"// "; 4. 5. File tmp_path=new File(savePath); 6. tmp_path.mkdirs(); 7. System.out.println("照片数据保存路径:"+savePath); System.out.println(" :"+savePath); 8. 9. 10.String pic_base_64_data=request.getParameter("picData"); 11. 如果下面的代码输出 则说明需要调整服务器软件工作参数,解决 12.//如果下面的代码输出 true 则说明需要调整服务器
软件工作参数 接受 post 数据的大小限制问题 数据的大小限制
问题,例如
13.//tomcat 的话需要在 server.xml 中配置 maxPostSize="0"来解除上传数 据的大小限制
16.// 17.System.out.println(null==pic_base_64_data); 18. 19.System.out.println("base64 string length:"+pic_base_64_data.len gth()); 20.String fileFormat=request.getParameter("picExt"); 21.sun.misc.BASE64Decoder decode=new sun.
misc.BASE64Decoder(); 22. 23.byte[] datas=decode.decodeBuffer(pic_base_64_data); 24. 25.String filename=String.valueOf(System.currentTimeMillis())+file Format; 26.File file=new File(savePath+filename); 27.OutputStream fos=new FileOutputStream(file); 28.System.out.println("图片文件名称:"+filename); 29.fos.write(datas); 30.fos.close(); 31. 32.out.print("
click here"); 33.out.flush(); 34.out.close(); 35.%>