# Upload information

Files can be uploaded through this interface to be sent to the merchant for custom goods shipment after the order is placed

# NOTE:

  1. Maximum file support of 50 M
  2. Add HTTP header Content-Type: multipart / form-data

# Dxplaination of Interface Call Request

http请求方式: POST
https://api.weixin.qq.com/channels/ec/open/upload?access_token=ACCESS_TOKEN

# Example Requests

Two ways to upload:

  1. Upload file binary (support < 10 M file size)
Parameter Name type Is it compulsory? Introductions Remarks
openid string yes User who uploaded the data openid
file file yes Content of uploaded data files Support image, CAD, 3dMax, shrink package, PDF, Excel, Word, etc.
upload_type int yes How to upload, send 0

Example request:

curl -F file=@test.png
"https://api.weixin.qq.com/channels/ec/open/upload?access_token=ACCESS_TOKEN&openid=xxxx&upload_type=0"

  1. Upload as file url (< 50 M file size is supported)
Parameter Name type Is it compulsory? Introductions Remarks
openid string yes User who uploaded the data openid
file_url file yes The url to upload the file Support image, CAD, 3dMax, shrink package, PDF, Excel, Word, etc.
upload_type int yes How to upload, send 1

Example request:

curl -X POSt -d'{"openid":"xxx","file_url":"xxx"}'
"https://api.weixin.qq.com/channels/ec/open/upload?access_token=ACCESS_TOKEN&upload_type=1"

# Supported file formats for upload:

type format Content-Type
picture .bmp image/bmp
picture .jpg image/jpeg,image/jpg
picture .jpeg image/jpeg,image/jpg
picture .png image/png,application/x-png
picture .svg text/xml
picture .webp image/webp
CAD .dwg application/acad
CAD .dxf application/dxf
CAD .dgn image/vnd.dgn
CAD .stl model/stl,application/sla
3DMax .max application/octet-stream
3DMax .3d application/octet-stream
3DMax .fbx application/octet-stream
3DMax .abc application/octet-stream
3DMax .dae application/octet-stream
Compressed package .zip application/zip
Compressed package .rar application/x-rar-compressed
Compressed package .7z application/x-7z-compressed
Compressed package .gz application/gzip,application/x-gzip
Ordinary documents .docx application/vnd.openxmlformats-officedocument.wordprocessingml.documen
Ordinary documents .doc application/msword
Ordinary documents .xls application/vnd.ms-excel
Ordinary documents .xlsx application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Ordinary documents .csv text/csv
Ordinary documents .pdf application/pdf

Note: Only supported file types can be included in the compression package

# Examples of back-up

{
  "errcode":0,
  "errmsg":"成功",
  "media_id":"892AERDPD2323"
}


# Dxplaination of callback parameters

parameter type describe
errcode int Error Code, 0 - Success, Other - Failure
errmsg string Error message
media_id string File media_id

# Error code

Error code describe
-1 The system failed. Please try again
0 success
10001 Invalid mediaid
10002 Invalid mediaid
10003 The file is being uploaded, please wait
10004 Uploading a file is risky, please re-upload
10005 Order cancelled, downloading of files is prohibited
10006 Order is closed and downloading of files is prohibited
10007 The upload file format is not supported
10008 Upload file size exceeds maximum value
10009 Download more files than the daily limit. Please try again the next day
10010 The upload url (file_url) is invalid. The file cannot be downloaded