• asp base64转图片注意事项


    程序:

    <%
    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设置后即可正常

     

  • 相关阅读:
    geoserver 文件系统
    geoserver 源码介绍
    geoserver 开发2
    geoserver 开发1
    geoserver笔记
    linux 下安装gult
    LINUX 笔记5
    SQLSTATE[HY000] [2002] 乱码
    微信开发
    javascript记忆
  • 原文地址:https://www.cnblogs.com/wuchaofan1993/p/11435071.html
Copyright © 2020-2023  润新知