程序:
<% Subfolder=year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now()) ''生成当天的子文件夹的名称 picture=Trim(request.Form("urls")) picture=replace(picture,"data:image/png;base64,","") path=Subfolder&".jpg" xmlstr="<data>"&picture&"</data>" Dim xml : Set xml=Server.CreateObject("MSXML2.DOMDocument") Dim stm : Set stm=Server.CreateObject("ADODB.Stream") xml.resolveExternals=False xml.loadxml(xmlstr) xml.documentElement.setAttribute "xmlns:dt","urn:schemas-microsoft-com:datatypes" xml.documentElement.dataType = "bin.base64" stm.Type=1 'adTypeBinary stm.Open stm.Write xml.documentElement.nodeTypedValue stm.SaveToFile Server.MapPath(path) stm.Close Set xml=Nothing Set stm=Nothing response.Write("http://codeo.cn/"&path) %>
1:出现以下错误
msxml3.dll 错误 '80004005'
将 分析为 bin.base64 数据类型时发生错误。
原因:当文件后缀为“.png是程序运行正常”,因为程序已对png格式文件进行处理
picture=replace(picture,"data:image/png;base64,","")
针对后缀为jpg的图片只需添加以下程序即可
picture=replace(picture,"data:image/jpeg;base64,","")
2:出现下方错误时
Request 对象 错误 'ASP 0104 : 80004005' 不允许操作
修改iis设置后即可正常