1. 客户端上传文件至接入方后台说明

1.1. 提交方法

POST

1.2. 提交方式

以Content-Typ 为 multipart/form-data 提交form表单

1.3. 接口提交内容

调用接口样例:

CP.fileUpload({
    completed: function(data){
        // data > {requestcode:'', return: {"code": "1", "info": "提交成功","fileurl": "http://xxx.xxx.xxx/testString.jpg"}}
        CP.tools.writelog('file_upload', data);
    },
    cpIncompatible: function () {
         CP.tools.writelog('', '此环境不支持此方法');
    },
    serviceurl: 'https:xxx.xxx.com?m=xxx&subm=xxx',
    localfile: '',
    filename: 'testString',
    inputname: 'upload',
    extend: "{\"keyword1\":\"111\", \"keyword2\":\"222\"}"
});

提交内容样例:

--173b288b-6e3c-442b-811b-d36699e13b9e
Content-Disposition: form-data; name="upload"; filename="testString"; keyword1="111"; keyword2="222"
Content-Length: 21262
...
--173b288b-6e3c-442b-811b-d36699e13b9e--

1.4. 后台接口返回建议

返回建议为json字符串格式可自定义,返回字段将在回调函数 completed 的参数data的 return 字段中。

建议样例(参照调用接口代码) {requestcode:'', return: {"code": "1", "info": "提交成功","fileurl": "http://xxx.xxx.xxx/testString.jpg"}}

Copyright © 新媒体云服务平台 2019 all right reserved,powered by Gitbook该文件修订时间: 2022-08-12 17:13:14

results matching ""

    No results matching ""