| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 651 人关注过本帖
标题:[求助]我想实现这个用FSO组件。
只看楼主 加入收藏
hadisi
Rank: 1
等 级:新手上路
帖 子:82
专家分:0
注 册:2006-5-15
收藏
 问题点数:0 回复次数:7 
[求助]我想实现这个用FSO组件。
我想实现一个下拉菜单,里面的内容是循环一个文件夹里的文件名,不是从数据库里取的
请问这段代码怎么写?(急用)
搜索更多相关主题的帖子: FSO 组件 数据库 文件名 
2006-05-29 11:53
icecool
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:20
帖 子:1215
专家分:1376
注 册:2005-3-14
收藏
得分:0 

<%
Dim fso,f, f1, fc, s,fpath
fpath="e:\123" ' 此处设置你要查看目录
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(fpath)
Set fc = f.Files
asdf=f.ShortPath
%>

<form name="form1">
<select name="type" >
<option value="名称">文件列表</option>

<%
For Each f1 in fc '显示文件
s = f1.name
vfilepath=asdf & "\" & s
response.write "<option value='file'>" & s & "</option>"
Next
%>
</select>
</form>


http://toorup.3v.do
loading...
2006-05-29 12:56
hadisi
Rank: 1
等 级:新手上路
帖 子:82
专家分:0
注 册:2006-5-15
收藏
得分:0 
谢谢版主
2006-05-29 13:05
hadisi
Rank: 1
等 级:新手上路
帖 子:82
专家分:0
注 册:2006-5-15
收藏
得分:0 

Microsoft VBScript 运行时错误 错误 '800a01ad'

ActiveX 部件不能创建对象: 'Scripting.FileSystemObject'

/admin/ChanPinFenLei.asp,行 212
报这个错,怎么办?

2006-05-29 13:27
icecool
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:20
帖 子:1215
专家分:1376
注 册:2005-3-14
收藏
得分:0 

应该是你的服务器不支持FSO

你可先在自已机子上调试看看


http://toorup.3v.do
loading...
2006-05-29 14:03
hadisi
Rank: 1
等 级:新手上路
帖 子:82
专家分:0
注 册:2006-5-15
收藏
得分:0 

版主我把您说的路径给改成相对路径了但还是有问题您看看这样改对吗?
<%Dim fso,f, f1, fc, s,fpath
Dim tempCurrentPath,CurrentPath,DirectoryRoot

DirectoryRoot=Trim(Request("DirectoryRoot"))
if DirectoryRoot="" or DirectoryRoot="/" then
DirectoryRoot = "/"
else
if right(DirectoryRoot,1)<>"/" then
DirectoryRoot = DirectoryRoot&"/"
end if
end if

qlj=trim(request("qlj"))
fjx="DirectoryRoot="&DirectoryRoot&"&qlj="&qlj

tempCurrentPath=FilterPath(Trim(Request("CurrentPath"))) ‘19行


If tempCurrentPath<>"" Then
if instrrev(tempCurrentPath,"/")=0 then
ParentFolder=""
else
ParentFolder=left(tempCurrentPath,instrrev(tempCurrentPath,"/")-1)
end if

Else
ParentFolder=tempCurrentPath
End If


if tempCurrentPath<>"" and left(tempCurrentPath,1)="/" then
tempCurrentPath = mid(tempCurrentPath,2)
end if

if tempCurrentPath<>"" and right(tempCurrentPath,1)<>"/" then
tempCurrentPath = tempCurrentPath&"/"
end if


If tempCurrentPath="" Then
CurrentPath=DirectoryRoot
Else
CurrentPath=DirectoryRoot & tempCurrentPath
End If


If Fso.FolderExists(Server.MapPath(CurrentPath)) Then
'获得虚拟文件系统主目录DirectoryRoot
Set Fol=Fso.GetFolder(Server.MapPath(CurrentPath))
Else
'若虚拟文件系统主目录未找到,则创建该目录
If CurrentPath=DirectoryRoot Then
Fso.CreateFolder(Server.MapPath(CurrentPath))
Set Fol=Fso.GetFolder(Server.MapPath(CurrentPath))
End If
End If

'fpath="E:\公共\duihao.net\duihao.net\chengxu\FileSystem" ' 此处设置你要查看目录
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(CurrentPath)
Set fc = f.Files
asdf=f.ShortPath
For Each f1 in fc '显示文件
s = f1.name
vfilepath=asdf & "\" & s
response.write "<option value='file'>" & s & "</option>"
Next%>
报错地方是

Microsoft VBScript 运行时错误 错误 '800a000d'

类型不匹配: 'FilterPath'

/admin/ChanPinFenLei.asp,行 19


2006-05-29 14:45
icecool
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:20
帖 子:1215
专家分:1376
注 册:2005-3-14
收藏
得分:0 

这里是要用绝对路径的,

如果是想对路径你自已想办法转成绝对路径才能读出文件.

可看一下我以前写的一个文件,里面FSO用的比较多:

http://www.bc-cn.net/bbs/boke.asp?icecool.showtopic.822.html


http://toorup.3v.do
loading...
2006-05-29 16:35
hadisi
Rank: 1
等 级:新手上路
帖 子:82
专家分:0
注 册:2006-5-15
收藏
得分:0 
再一次感谢
2006-05-29 17:44
快速回复:[求助]我想实现这个用FSO组件。
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016501 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved