1

http://www.jiemai.com/imagesupload/1582/middle/0858-1-001.jpg

我想在经典 ASP 中将上述图像 URL 保存为名称为“0858-1-001.jpg”的文件。如果有人帮助我,我真的很感激。我试图使用许多 asp 脚本来读取该字节码。

4

1 回答 1

2

这里没有服务器,但这里是经过测试的 vbscript 版本,要在 asp 中使用它,您只需将 creatObject 替换为 Server.CreateObject

function download(url, destination)
  download = false
  on error resume next
  set xml = CreateObject("Microsoft.XMLHTTP")
  xml.Open "GET", url, False
  xml.Send
  if err.number = 0 then
    if xml.readystate = 4 then
      if xml.status = 200 then 
        wscript.echo xml.readystate
        wscript.echo xml.status
        set oStream = createobject("Adodb.Stream")
        const adTypeBinary = 1,  adSaveCreateOverWrite = 2, adSaveCreateNotExist = 1 
        oStream.type = adTypeBinary
        oStream.open
        oStream.write xml.responseBody
        oStream.saveToFile destination, adSaveCreateOverWrite
        oStream.close
        set oStream = nothing
        download = true
      end if
    end if
  end if
  set xml = Nothing
end function
于 2012-05-29T22:26:52.560 回答