`
- 浏览:
54009 次
- 性别:
- 来自:
湖北武汉
-
servlet中测试成功:
java 代码
- String filesystempath = request.getSession().getServletContext().getRealPath("/");
- ServletRequestContext srcontext = new ServletRequestContext(request);
- System.out.println(srcontext.getCharacterEncoding());
- System.out.println(srcontext.getContentType());
- boolean isMultipart = ServletFileUpload.isMultipartContent(request);
- if (isMultipart) {
- ServletFileUpload upload = new ServletFileUpload();
- try {
-
- FileItemIterator iter = upload.getItemIterator(request);
- while (iter.hasNext()) {
- FileItemStream item = iter.next();
- //System.out.println(item.getContentType());
- InputStream stream = item.openStream();
- if (item.isFormField()) {
-
- } else {
-
- String clientrealpath = item.getName();
- clientrealpath = clientrealpath.replace("\\", "\\\\");
-
- String filename = StringHelper.getFileName(clientrealpath);
-
- File newfile = new File(filesystempath+filename);
- OutputStream os =new FileOutputStream(newfile);
- byte[] b = new byte[8192];
- int len;
- while ((len = stream.read(b)) != -1) {
- os.write(b, 0, len);
- os.flush();
- os.close();
- stream.close();
-
- }
- }
- } catch (FileUploadException e) {
- e.printStackTrace();
- }
- }
分享到:
Global site tag (gtag.js) - Google Analytics
相关推荐
赠送jar包:netty-common-4.1.65.Final.jar; 赠送原API文档:netty-common-4.1.65.Final-javadoc.jar; 赠送源代码:netty-common-4.1.65.Final-sources.jar; 赠送Maven依赖信息文件:netty-common-4.1.65.Final....
赠送jar包:netty-transport-native-unix-common-4.1.68.Final.jar; 赠送原API文档:netty-transport-native-unix-common-4.1.68.Final-javadoc.jar; 赠送源代码:netty-transport-native-unix-common-4.1.68....
赠送jar包:netty-transport-native-unix-common-4.1.73.Final.jar; 赠送原API文档:netty-transport-native-unix-common-4.1.73.Final-javadoc.jar; 赠送源代码:netty-transport-native-unix-common-4.1.73....
hadoop-common-2.10.0-tests.jar hadoop-common-2.10.0.jar hadoop-nfs-2.10.0.jar hamcrest-core-1.3.jar htrace-core4-4.1.0-incubating.jar httpclient-4.5.2.jar httpcore-4.4.4.jar jackson-core-asl-1.9.13....
赠送jar包:auto-common-1.2.jar; 赠送原API文档:auto-common-1.2-javadoc.jar; 赠送源代码:auto-common-1.2-sources.jar; 赠送Maven依赖信息文件:auto-common-1.2.pom; 包含翻译后的API文档:auto-common-...
赠送jar包:netty-common-4.1.73.Final.jar; 赠送原API文档:netty-common-4.1.73.Final-javadoc.jar; 赠送源代码:netty-common-4.1.73.Final-sources.jar; 赠送Maven依赖信息文件:netty-common-4.1.73.Final....
赠送jar包:netty-common-4.1.68.Final.jar; 赠送原API文档:netty-common-4.1.68.Final-javadoc.jar; 赠送源代码:netty-common-4.1.68.Final-sources.jar; 赠送Maven依赖信息文件:netty-common-4.1.68.Final....
赠送jar包:wildfly-common-1.5.2.Final.jar; 赠送原API文档:wildfly-common-1.5.2.Final-javadoc.jar; 赠送源代码:wildfly-common-1.5.2.Final-sources.jar; 赠送Maven依赖信息文件:wildfly-common-1.5.2....
赠送jar包:netty-transport-native-unix-common-4.1.74.Final.jar; 赠送原API文档:netty-transport-native-unix-common-4.1.74.Final-javadoc.jar; 赠送源代码:netty-transport-native-unix-common-4.1.74....
赠送jar包:flink-table-common-1.12.7.jar; 赠送原API文档:flink-table-common-1.12.7-javadoc.jar; 赠送源代码:flink-table-common-1.12.7-sources.jar; 赠送Maven依赖信息文件:flink-table-common-1.12.7....
`ibxml2-2.6.23-1.2.i386.rpm` 包是针对i386架构(32位)的CentOS的一个特定版本,确保了系统的兼容性。 第二个包,`libxml2-devel-2.6.23-1.2.i386.rpm`,是开发包,包含了头文件和静态链接库,这些都是开发人员在...
赠送jar包:netty-common-4.1.27.Final.jar; 赠送原API文档:netty-common-4.1.27.Final-javadoc.jar; 赠送源代码:netty-common-4.1.27.Final-sources.jar; 赠送Maven依赖信息文件:netty-common-4.1.27.Final....
赠送jar包:netty-transport-native-unix-common-4.1.73.Final.jar; 赠送原API文档:netty-transport-native-unix-common-4.1.73.Final-javadoc.jar; 赠送源代码:netty-transport-native-unix-common-4.1.73....
vim-common-7.4.629-7.el7.x86_64.rpm
spring依赖的common-logging jar包
赠送jar包:netty-common-4.1.73.Final.jar; 赠送原API文档:netty-common-4.1.73.Final-javadoc.jar; 赠送源代码:netty-common-4.1.73.Final-sources.jar; 赠送Maven依赖信息文件:netty-common-4.1.73.Final....
clickhouse-22.2.2.1-2.rpm离线安装包包含clickhouse-common-static-22.2.2.1-2.x86_64.rpm,clickhouse-client-22.2.2.1-2.noarch.rpm,clickhouse-server-22.2.2.1-2.noarch.rpm共3个离线安装rpm包。 安装: rpm -...
赠送jar包:netty-common-4.1.24.Final.jar; 赠送原API文档:netty-common-4.1.24.Final-javadoc.jar; 赠送源代码:netty-common-4.1.24.Final-sources.jar; 赠送Maven依赖信息文件:netty-common-4.1.24.Final....
赠送jar包:nacos-common-2.0.4.RELEASE.jar; 赠送原API文档:nacos-common-2.0.4.RELEASE-javadoc.jar; 赠送源代码:nacos-common-2.0.4.RELEASE-sources.jar; 赠送Maven依赖信息文件:nacos-common-2.0.4....
dhcp-common-4.1.1-31.P1.el6.i686.rpm