ASP保存远程文件到本地_ASP教程
推荐:asp无组件上传带真实进度条asp无组件上传带真实进度条无组件上传带真实进度条 其中 upload.asp为核心代码,除非特殊需要,一般不需要修改 demo.htm是演示无刷新进度条(IE5.5+支持) demo.asp为处理demo.asp上传的文件,因为演示需要,在Demo.asp中仅仅上传,不作保存,如果需要保存,只需去掉相关
<%
Function SaveRemoteFile(LocalFileName,RemoteFileUrl)
SaveRemoteFile=True
dim Ads,Retrieval,GetRemoteData
Set Retrieval = Server.CreateObject("Microsoft.XMLHTTP")
With Retrieval
.Open "Get", RemoteFileUrl, False, "", ""
.Send
If .Readystate<>4 then
SaveRemoteFile=False
Exit Function
End If
GetRemoteData = .ResponseBody
End With
Set Retrieval = Nothing
Set Ads = Server.CreateObject("Adodb.Stream")
With Ads
.Type = 1
.Open
.Write GetRemoteData
.SaveToFile server.MapPath(LocalFileName),2
.Cancel()
.Close()
End With
Set Ads=nothing
End Function
%>
<%
'以下为调用示例:
remoteurl="http://www.uyux.cn/logo.gif"'远程文件名(绝对全路径)
localfile=Replace(Replace(Replace(Now(),"-","")," ",""),":","")&Right(remoteurl,4)'本机文件名(可自定义)
If SaveRemoteFile(localfile,remoteurl)=True Then
Response.Write("成功保存:"&localfile)
End If
%>
-
分享:ASP实现静态无刷新分页效果#FormatTableID_0# html head title新闻列表简化型/title script language=javascript !-- //ajax 控件也可以做成单独文件方便到其它地方调用 function Ajax() { var xhrObj=null; if(window.XMLHttpRequest) { xhrObj=new XMLHttpRequest(); } else if(window.ActiveX
- 相关链接:
- 教程说明:
ASP教程-ASP保存远程文件到本地。