Commit 890af5fa authored by 张永's avatar 张永

1

parent 5f9e9e36
...@@ -301,7 +301,7 @@ public class HttpsUtil { ...@@ -301,7 +301,7 @@ public class HttpsUtil {
sb.append("--"); // 必须多两道线 sb.append("--"); // 必须多两道线
sb.append(BOUNDARY); sb.append(BOUNDARY);
sb.append("\r\n"); sb.append("\r\n");
sb.append("Content-Disposition: form-data;name=\"file\";filename=\"" + file.getName() + "\"\r\n"); sb.append("Content-Disposition: form-data;name=\"file\";filename=\"" + file.getName() + "\"\r\n");
sb.append("Content-Type:application/octet-stream\r\n\r\n"); sb.append("Content-Type:application/octet-stream\r\n\r\n");
byte[] head = sb.toString().getBytes("utf-8"); byte[] head = sb.toString().getBytes("utf-8");
...@@ -315,7 +315,7 @@ public class HttpsUtil { ...@@ -315,7 +315,7 @@ public class HttpsUtil {
// 把文件已流文件的方式 推入到url中 // 把文件已流文件的方式 推入到url中
DataInputStream in = new DataInputStream(new FileInputStream(file)); DataInputStream in = new DataInputStream(new FileInputStream(file));
int bytes = 0; int bytes = 0;
byte[] bufferOut = new byte[1024]; byte[] bufferOut = new byte[1024]; // 1M
while ((bytes = in.read(bufferOut)) != -1) { while ((bytes = in.read(bufferOut)) != -1) {
out.write(bufferOut, 0, bytes); out.write(bufferOut, 0, bytes);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment