自动采集程序(2)
End If
Set folder=Nothing
file=xmlhttp.ResponseBody
If lenb(file) > allowFileSize Then
getFile = "文件太大,不能保存!"
Exit Function
Else
Set objAdostream=Server.Createobject("ADODB.Str"&"eam")
objAdostream.Open()
objAdostream.Type=1
objAdostream.Write(file)
objAdostream.SaveToFile(Server.Mappath(uploadPath & folderName &"/" & newFilePath))
objAdostream.SetEOS
Set objAdostream=Nothing
getFile= "<a href="""&uploadPath & folderName &"/" & newFilePath&""" target=""_balnk"">采集成功</a>"
End If
End If
Set xmlhttp=Nothing
End Function
%>
<script runat="server" language="jscript">
function cleanFileName(str){
str = str.replace(/[^_\.a-zA-Z\d]/ig,"");
str = str.replace(/^[\/\.]+/,"");
return str;
}
function getNow(n)
{
d = new Date();
switch (n)
{
case "Year":
return d.getYear();
case "Month":
return (d.getMonth() + 1);
case "Date":
return d.getDate();
}
}
</script>
<%if request("do")="getfile" and request("file") <> "" then
response.write(getFile(request("file")))
else%>
<form id="gform" method="post" action="?do=getfile" style="display: inline">
<input name="file" type="input" style="font-size:12px;" size="40" value="http://blog.xiaobin.net/uploads/200512/08_093616_01.gif">
<input type="Submit" name="Submit" value="采集 " class="button">
</form>
<%end if%>