我在 asp 经典中使用 vbscript。我还使用了 FreeASPUpload 类。我想上传文件不是在本地,而是使用其 IP 地址作为路径上传到服务器。
如果我将在本地上传,这是代码工作..
Dim uploadsDirVar
uploadsDirVar = Server.MapPath("../temp/")
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)
但我想将它上传到带有 ip 地址的路径中。下面是我尝试过的代码,但它导致 HTTP 500 内部服务器错误。
Dim uploadsDirVar
uploadsDirVar = "\\123.45.6.789\DocFolder\"
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)
由于登录,我已经在本地映射了文件夹 \123.45.6.789\DocFolder\。我也尝试了带有凭据的代码,但仍然出现同样的错误。见下文:
Dim ServerShare
Dim UserName
Dim Password
Dim NetworkObject
Dim FSO
ServerShare = "\\123.45.6.789\DocFolder\"
UserName = "domain\username"
Password = "password"
Set NetworkObject = CreateObject("WScript.Network")
Set FSO = CreateObject("Scripting.FileSystemObject")
NetworkObject.MapNetworkDrive "", ServerShare, False, UserName, Password
Dim uploadsDirVar
uploadsDirVar = "\\123.45.6.789\DocFolder\"
Set Upload = New FreeASPUpload
Upload.Save(uploadsDirVar)
结果还是一样..有人可以帮忙吗?我是 asp classic 和 vbscript 的新手,尤其是在文件上传及其行为方面。谢谢