Commit 9a238861 authored by Quxl's avatar Quxl

x

parent a212a30e
......@@ -298,8 +298,11 @@ public class HttpUtil {
return StringUtil.join("&", params);
}
public static String post(String requestUrl, Map<String, Object> parameters, Map<String, String> headers,
Map<String, File> attachments, String contentType) {
public static String post(String requestUrl, Map<String, Object> parameters, Map<String, String> headers, Map<String, File> attachments) {
return post(requestUrl, parameters, headers, attachments, "application/octet-stream");
}
public static String post(String requestUrl, Map<String, Object> parameters, Map<String, String> headers, Map<String, File> attachments, String contentType) {
HttpURLConnection connection = null;
try {
Data data = new Data();
......@@ -320,9 +323,8 @@ public class HttpUtil {
StringBuffer FileBuffer = new StringBuffer();
File file = attachments.get(name);
FileBuffer.append("--" + BOUNDARY + "\r\n");
FileBuffer.append("Content-Disposition: form-data; name=\"" + name + "\"; filename=\""
+ file.getName() + "\"" + "\r\n");
FileBuffer.append("Content-Type:" + contentType + "" + "\r\n");
FileBuffer.append("Content-Disposition: form-data; name=\"" + name + "\"; filename=\"" + file.getName() + "\"" + "\r\n");
FileBuffer.append("Content-Type:" + contentType + "\r\n");
FileBuffer.append("\r\n");
String FileBufferString = FileBuffer.toString();
data.add(FileBufferString.getBytes());
......
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