# Upload pictures

# Interface call request specification

Http request method: POST
https://api.weixin.qq.com/product/img/upload?access_token=xxxxxxxxx&upload_type=0&resp_type=0&height=108&width=108

# URL parameter explaination

parameter type Is it necessary to fill out Introductions
upload_type number yes Upload type: 0-binary stream, 1-image url
or_type number yes Return data type: 0-media_id和pay_media_Id (2MB limit for uploading this type of image), 1 - temporary link to imagePicture of the DayBe sure to use this parameter to get a temporary link.)
height number no upload_Required when type = 0, height of image, in pixels
width number no upload_Type = 0, width of picture, in pixels

# POST package request parameter explaination

parameter type Is it necessary to fill out Introductions
img_url string no upload_Type = 1, picture url

# Sample Request 1

curl -F media=@test.jpg "https://api.weixin.qq.com/product/img/upload?access_token=xxxxxxxxx&upload_type=0&resp_type=0&height=108&width=108"

# Return Example 1

{
    "errcode": 0,
    "errmsg":"ok",
    "pic_file":
    {
        "media_id":   "xlvjalsdhgas",
        "pay_media_id": "asdgasvdadfa"
    }
}

# Sample Request 2

curl D "{"img_url":"https://xxx.com/yyy"}" " http://api.weixin.qq.com/product/img/upload?access_token=xxxxxxxxx&upload_type=1&resp_type=1"

# Example 2 Return Pack

{
    "errcode":0,
    "pic_file":
    {
        "temp_img_url": 'xxxxx'
    }
}

# Return parameter specification

parameter type Introductions
Errcode number Error code
errmsg string Error message
pic_file.media_id number media_id
pic_file.pay_media_id string Payment media _id
temp_img_url string Picture temporary url,Valid for 3 days

# Return code

Return code Type of error
-1 System exception
-2 Token is too long
600201 This link does not need to be converted and can be used directly with the domain namestore.mp.video.tencent-cloud.com