示例#1
0
        public static void GetForeverMedia(string savePath, string access_token, string media_id)
        {
            var        url = string.Format("http://file.api.weixin.qq.com/cgi-bin/media/get?access_token={0}&media_id={1}", access_token, media_id);
            FileStream fs  = new FileStream(savePath, FileMode.Create);

            WechatCurlFileTools.Download(url, fs);
            fs.Close();
            fs.Dispose();
        }
示例#2
0
        public static string UploadForeverMedia(string access_token, string type, string fileName, Stream inputStream)
        {
            var url    = string.Format("https://api.weixin.qq.com/cgi-bin/material/add_material?access_token={0}&type={1}", access_token, type.ToString());
            var result = WechatCurlFileTools.HttpRequestPost(url, "media", fileName, inputStream);

            inputStream.Close();
            inputStream.Dispose();
            return(result);
        }