请问,解决了吗 我也是c# 一直提示media data missing
C#调用上传备案媒体材料一直报错41005,media data missing,怎么解决?private string uploadIcpMedia(HttpContext context) { string accessToken = context.Request.QueryString["access_token"]; string type = context.Request.Form["type"]; string certificateType = context.Request.Form["certificate_type"]; string icpOrderField = context.Request.Form["icp_order_field"]; HttpPostedFile file = context.Request.Files["media"]; byte[] mediaBytes = ReadFileBytes(file); if (!string.IsNullOrEmpty(accessToken) && !string.IsNullOrEmpty(type) && !string.IsNullOrEmpty(icpOrderField)) { if (file != null) { string apiUrl = $"https://api.weixin.qq.com/wxa/icp/upload_icp_media?access_token={accessToken}"; var httpClient = new HttpClient(); string boundary = Guid.NewGuid().ToString("N"); var content = new MultipartFormDataContent(boundary); //content.Headers.ContentType = MediaTypeHeaderValue.Parse($"multipart/form-data;boundary={boundary}"); content.Add(new StringContent(type), "type"); content.Add(new StringContent(certificateType), "certificate_type"); content.Add(new StringContent(icpOrderField), "icp_order_field"); content.Add(new ByteArrayContent(mediaBytes), "media", $"\"{file.FileName}\""); string requestString = content.ReadAsStringAsync().Result; var postResult = httpClient.PostAsync(apiUrl, content).Result; string result = postResult.Content.ReadAsStringAsync().Result; return result; } else { return "No media data provided"; } } else { return "Missing required parameters: access_token, type, and/or icp_order_field"; } } 请求返回{ "errcode": 41005, "errmsg": "media data missing, hint: [2c54ff85-e7ab-4e0c-8f37-385218c0a87d] rid: 655825b1-49c05972-19528b29"},之前看到一个帖子,说把boundary的引号去掉就可以,就是代码里注释掉的那一行,但是那只适用form-data只有上传media一个参数。在这个上传备案媒体材料接口,form-data上传多个参数,把boundary的引号去掉就会报missing parameter的错,但是注释掉就会报错media data missing。到底应该怎么解决,我使用的是.net4.8。
2023-12-15你好,请问实现了分片上传吗? 我在同时选择视频和图片遍历上传的时候遇到了问题,分片接口query中的fileName始终是同一个值,你有遇到这个问题吗
miniprogram-file-uploader使用报错?[图片] [图片]
2022-09-28楼主你好,请问一下你做的这个大文件上传支持多遍历吗,我同时选择一个视频和一个图片,fileName始终是同一个值,这是我提出的帖子:https://developers.weixin.qq.com/community/develop/doc/000c00a3a44388f7ba9e928155e400?highLine=miniprogram-file-uploader
miniprogram-file-uploader 可以选择视频进行上传吗?https://developers.weixin.qq.com/miniprogram/dev/extended/component-plus/uploader.htmlminiprogram-file-uploader 该组件可以选择视频上传吗?我用开发工具调用该组件,只能进入相册选择图片
2022-09-28