上传文件
This commit is contained in:
parent
b2725c3bbc
commit
7bee783f8c
@ -47,10 +47,9 @@ public class WxTokenUtils {
|
|||||||
|
|
||||||
public static WxFileUploadResult uploadImage(String filePath, String fileName, String accessToken) {
|
public static WxFileUploadResult uploadImage(String filePath, String fileName, String accessToken) {
|
||||||
try {
|
try {
|
||||||
String url = uploadMaterialUrl + "?access_token" + accessToken + "&type=image";
|
String url = uploadMaterialUrl + "?access_token=" + accessToken + "&type=image";
|
||||||
HttpPostUtil post = new HttpPostUtil(url);
|
HttpPostUtil post = new HttpPostUtil(url);
|
||||||
post.addParameter("media", new File(filePath));
|
post.addParameter("media", new File(filePath));
|
||||||
post.addParameter("name", fileName);
|
|
||||||
String resultStr = post.send();
|
String resultStr = post.send();
|
||||||
JSONObject obj = JSONObject.parseObject(resultStr);
|
JSONObject obj = JSONObject.parseObject(resultStr);
|
||||||
WxFileUploadResult result = JSONObject.toJavaObject(obj, WxFileUploadResult.class);
|
WxFileUploadResult result = JSONObject.toJavaObject(obj, WxFileUploadResult.class);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user