繁体   English   中英

VBScript的CopyFile无法正常工作

[英]VBScript's CopyFile not working

我认为它可能与外部文件有关,但我收到错误Path not found ,不知道为什么。 代码如下。

<%

Dim fs
set fs = Server.CreateObject("Scripting.FileSystemObject")
fs.CopyFile "http://domain.com/file.xml","softvoyage.xml"
set fs = Nothing

%>DONE.

FileSystemObject仅用于本地磁盘文件。 尝试这个:

<%
    url = "http://www.espn.com/main.html" 
    set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP") 
    xmlhttp.open "GET", url, false 
    xmlhttp.send "" 
    Response.write xmlhttp.responseText 
    set xmlhttp = nothing 
%>

发现于http://classicasp.aspfaq.com/general/how-do-i-read-the-contents-of-a-remote-web-page.html

我不相信CopyFile方法可以从http源复制文件。 我见过的关于source参数的唯一例子是本地文件系统上的文件:

FileSystemObject.CopyFile "c:\srcFolder\srcFile.txt", "c:\destFolder\"

如果需要从http请求保存数据,请查看IXMLHTTPRequest对象

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM