Coder Social home page Coder Social logo

Comments (2)

carto1111 avatar carto1111 commented on May 24, 2024 1

大师,SDK源码里
src/Senparc.Weixin.Work/Senparc.Weixin.Work/AdvancedAPIs/Media/MediaApi.cs
这里面的上传方法,教程里面都是直接调用传路径进来,看来是少了media文件标识,微信返回媒体文件为空。
///


/// 上传临时媒体文件【QY移植修改】
///

/// 调用接口凭证(AccessToken)或AppKey(根据AccessTokenContainer.BuildingKey(corpId, corpSecret)方法获得)
/// 媒体文件类型,分别有图片(image)、语音(voice)、视频(video),普通文件(file)
/// form-data中媒体文件标识,有filename、filelength、content-type等信息
/// 代理请求超时时间(毫秒)
///
public static UploadTemporaryResultJson Upload(string accessTokenOrAppKey, UploadMediaFileType type, string media, int timeOut = Config.TIME_OUT)
{
return ApiHandlerWapper.TryCommonApi(accessToken =>
{
var url = string.Format(Config.ApiWorkHost + "/cgi-bin/media/upload?access_token={0}&type={1}", accessToken.AsUrlData(), type.ToString());
var fileDictionary = new Dictionary<string, string>();
fileDictionary["media"] = media;
return CO2NET.HttpUtility.Post.PostFileGetJson(CommonDI.CommonSP, url, null, fileDictionary, null, null, null, false, timeOut: timeOut);
}, accessTokenOrAppKey);

    }

from weixinmpsdk.

JeffreySu avatar JeffreySu commented on May 24, 2024

@carto1111  方便把你能重现问题的代码展示一下吗?

from weixinmpsdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.