View Full Version : Fso doesn't work on my localhost...
BarrMan
09-04-2006, 05:18 PM
I use IIS 5.1.
Can anyone help me please?
oracleguy
09-04-2006, 07:08 PM
Can you give a little more information than that? Do you get any sort of error messages? Can you create the object, just not use any of the methods?
BarrMan
09-04-2006, 07:50 PM
Yea,
I use this code:
<%
Set Fso = Server.CreateObject("Scripting.FileSystemObject")
Set Folder = Fso.GetFolder("C:/")
For Each item In Folder
Response.Write item.filename
Next
%>
And I get this error:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method
/salnews/cp/gallery.asp, line 11
Roelf
09-04-2006, 10:27 PM
After setting the Folder object, you should call the Folder.Files to get a collection of Files. That collection can be displayed using the File.Name attribute for each file
Like
Set Fso = Server.CreateObject("Scripting.FileSystemObject")
Set Folder = Fso.GetFolder("C:/")
Set FileCollection = Folder.Files
For Each item In FileCollection
Response.Write item.Name
Next
And to display the subfolders of the folder, call the Folder.SubFolders to get a collection of subfolders which you can use to display their names
Set Fso = Server.CreateObject("Scripting.FileSystemObject")
Set Folder = Fso.GetFolder("C:/")
Set FolderCollection = Folder.SubFolders
For Each item In FolderCollection
Response.Write item.Name
Next
Haven't tested it, but it should work
BarrMan
09-04-2006, 11:23 PM
Yea, I've already spotted my problem.
It might have been the localhost too because I've done 2 things to solve it:
1. Changed the code.
2. Installed windows XP scripting 5.6.
Thanks alot for the help :)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.