File upload 如何将fileinputstream字节作为octetstream获取?
嗨,朋友们,我正试图发送一个发帖请求。在我看来,鲨鱼的身体是这样的File upload 如何将fileinputstream字节作为octetstream获取?,file-upload,http-post,httpclient,fileinputstream,File Upload,Http Post,Httpclient,Fileinputstream,嗨,朋友们,我正试图发送一个发帖请求。在我看来,鲨鱼的身体是这样的 ------WebKitFormBoundaryPGENMvyXR2Vt226r Content-Disposition: form-data; name="csrf_token" csrf:MxLfAIgtghMohbOWeEwFv11Ou8eedDFQO0NXw6DGcZC1w1hTDo1umrysYcxho6bX ------WebKitFormBoundaryPGENMvyXR2Vt226r Content-Dispo
------WebKitFormBoundaryPGENMvyXR2Vt226r
Content-Disposition: form-data; name="csrf_token"
csrf:MxLfAIgtghMohbOWeEwFv11Ou8eedDFQO0NXw6DGcZC1w1hTDo1umrysYcxho6bX
------WebKitFormBoundaryPGENMvyXR2Vt226r
Content-Disposition: form-data; name="imagefilename"; filename="myFilemain.bin"
Content-Type: application/octet-stream
...qz...OO.M..g...`.:...../o.up.........G............y......f;....&Il..*..A.........0. E.fP.P------------------here is my bin file bytes---------------
..C.x...Q..J.._+%.. bla bla
但当我在代码端发布时,似乎是这样的:
------WebKitFormBoundaryPGENMvyXR2Vt226r
Content-Disposition: form-data; name="csrf_token"
csrf:MxLfAIgtghMohbOWeEwFv11Ou8eedDFQO0NXw6DGcZC1w1hTDo1umrysYcxho6bX
------WebKitFormBoundaryPGENMvyXR2Vt226r
Content-Disposition: form-data; name="imagefilename"; filename="myFilemain.bin"
Content-Type: application/octet-stream
²qz‹ÁOOõMÓâg‘Ç`:Êëá‡/oåupˆéìŒÛ.Ó‰G²¹²ƒö‘•®yñúÇÌ°f;ª¥ŸÉ&Il³š*ÄAŞøØÄñŠ…¦0Ğ EfP½P
£¢CÓxÀQÃJ¥_+%ã—¢ÌGà¸,Öû¶a4ªW&Ú×zÇñg~5. ³%FÀìDëÀ²tñş)Aéåf>¥jÀƒã8 ±šeH™Íäi“ktÇ ‡0¢û³ımİp‘}à
------WebKitFormBoundaryPGENMvyXR2Vt226r--
如何将字节作为八位字节流获取
这是我的密码:
FileInputStream fis = null;
try {
fis = new FileInputStream(uploadFile);
InputStreamReader inputStreamReader = new InputStreamReader(fis, "UTF-8");
BufferedReader br = new BufferedReader(inputStreamReader);
String line;
while ((line = br.readLine()) != null) {
builder.append(line.toCharArray());//stringBuilder
System.out.println(line.toCharArray());
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
是有关多部分文件上载示例的一些信息