• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 951
  • Last Modified:

objFSO

i have two different server one is a webserver and the other is a storage server,
in my web page using vbscript, i was trying to read the files inside the storage server but i keep getting invalid directory or file not found
this is the way i did it. could you tell me how to fix this thank you very much.
please help me asap. thank you very much
set objFSO = CreateObject("Scripting.FileSystemObject")
set objFile = objFSO.GetFile("\\server2\images\folder1\)
set objFolder = objFile.ParentFolder
set objFolderContents = objFolder.Files

Open in new window

0
StewSupport
Asked:
StewSupport
  • 2
1 Solution
 
Jared LukerCommented:
It's probably a permissions issue.  The file and folder permissions have to be set up so that the anonymous or authenticated user account has at least read access to it.  If it does not, then Windows will deny access to the file.

The file also has to be in a location that the web server can access.
0
 
StewSupportAuthor Commented:
how do i set it up then?
0
 
Jared LukerCommented:
well.. I only know how to do it with IIS.

If you are using anonymous access, then you need to set NTFS permissions on the folder1 that would give the anonymous account access to that file.

If you need to know how to set up NTFS permissions, there are lots of articles here on EE and on the web to help you with that.
0
 
RobSampsonCommented:
You are missing a filename in your GetFile call, but I guess you must have omitted that on purpose?

First, test straight from a VBS file, outside a web browser, from the desktop, to see if you've got the code right, then work permissions for the web page later.

Try something like this.

Regards,

Rob.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("\\Server2\Images")
For Each objFile In objFolder.Files
   WScript.Echo objFile.Path
Next

Open in new window

0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now