ajax发送base64,有人用ajax post过base64数据吗
var sinfo = b64;sinfo = sinfo.replace(/\+/g, "%2B");sinfo = sinfo.replace(/\&/g, "%26");var xmlhttp = null;var url = "../handler/B64toImg.ashx";if (window.ActiveXObject) {xmlhttp = new ActiveXObje
var sinfo = b64;
sinfo = sinfo.replace(/\+/g, "%2B");
sinfo = sinfo.replace(/\&/g, "%26");
var xmlhttp = null;
var url = "../handler/B64toImg.ashx";
if (window.ActiveXObject) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} else {
xmlhttp = new XMLHttpRequest();
}
xmlhttp.open("post", url, true);
xmlhttp.setRequestHeader("Content-Length", sinfo.length);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readystate == 4 && xmlhttp.status == 200) {
var ms = xmlhttp.responseText;
alert(ms);
}
}
xmlhttp.send(sinfo);
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "application/x-www-form-urlencoded";
string putout = context.Request.Form[0];
putout = putout.Replace("\r\n", "");
}
链接符号 +和&的处理我都做了,还有别的吗?
context.Request.Form[0];
我调试 在即时窗口输入context.Request.Form能看到传过来的base64数据context.Request.Form.count为“1”
context.Request.Form[0]却为“”
那base64是图片数据,我要post到服务器保存成文件,有没人做类似的?
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐


所有评论(0)