文件上传分析

POST /user_web/Testserv HTTP/1.1

Accept: image/jpeg,application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg,application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint,application/msword, */*

Referer:http://localhost:8080/user_web/

Accept-Language: zh-CN

User-Agent: Mozilla/4.0 (compatible; MSIE8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

Content-Type: multipart/form-data;boundary=---------------------------7de55f17095a

Accept-Encoding: gzip, deflate

Host: localhost:8080

Content-Length: 235

Connection: Keep-Alive

Cache-Control: no-cache

Cookie:JSESSIONID=iajk63AhJ4REYWmk3URXXzSy.alias-pc; wbNaN.user=webb


-----------------------------7de55f17095a

Content-Disposition: form-data;name="txt"; filename="read .txt"

Content-Type: text/plain


这是个文本文档

this is a text document

The last

-----------------------------7de55f17095a--


获取文件名:

BufferedReader bf=new BufferedReader(new InputStreamReader(in));
        String firstline=bf.readLine();
        String filename=bf.readLine();
        filename=filename.substring(filename.lastIndexOf("=")+2);
        filename=filename.substring(0,filename.length()-1);
        System.out.println("firstline:"+firstline);
        System.out.println("文件名:"+filename);



你可能感兴趣的:(java,fileupload,上传分析)