簡體   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