为什么文件为空/?!

heaton0720 2003-12-30 05:24:23
<%
function getRemoteFiles(remotePath,localPath,filename)
On Error Resume Next
'取得流
strbody=getBody(remotePath)
'取得保存的文件名
if right(localPath,1)<>"\" then
localPath=localPath & "\"
end if
filePath=localPath & getFileName(remotePath,filename)
'保存文件
if SaveToFile(strbody,filePath)=true and err.number=0 then
getRemoteFile=true
else
getRemoteFile=false
end if
end function

'获取远程内容
function getBody(url)
set retrieval=Server.CreateObject("microsoft.xmlhttp")
with retrieval
.Open "get",url,false,"",""
.Send
getBody=.ResponseBody
end with
set retrieval=nothing
end function

'重组文件名
function getFileName(remotePath,filename)
arrTmp=split(remotePath,".")
strFileExt=arrTmp(ubound(arrTmp))
getFileName=filename & "." & strFileExt
end function

'将内容保存为文件
function saveToFile(stream,filePath)
On Error Resume Next
set objStream=server.CreateObject("adodb.stream")
with objStream
.Type=1
.Open
.Write stream
.SaveToFile filePath,2
.Close()
end with
set objStream=nothing
if err.number<>0 then
saveToFile=false
else
saveToFile=true
end if
end function

strremotePath=Request.Form("123")
strlocalPath=Server.MapPath("include")
getRemoteFiles strremotePath,strlocalPath,ddr
%>

我在自己的机子上测试,结果上传什么文件,都变成了空文件,内容没有,连名字也没有
怎么会事(我第一次见可以没有名字的文件)!
...全文
61 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
zorou_fatal 2003-12-31
  • 打赏
  • 举报
回复
你的request.form里都有值吗?
patchclass 2003-12-31
  • 打赏
  • 举报
回复
用这个的microsoft.xmlhttp
没有用过,不会
patchclass 2003-12-31
  • 打赏
  • 举报
回复
saveToFile
保存有问题?还没有遇到过
heaton0720 2003-12-31
  • 打赏
  • 举报
回复
有啊,就是<input type="file" name="123">
然后我分别上传一个文本文件和一个图片,在我的include下都是空的文件(没名字,没内容
就显示图标),你可以复制过去试试啊!为什么啊

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧