Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 793
  • Last Modified:

File System Object - How to encode path with spaces

This should hopefully be easy...

If I use the following:

Set folder = fso.GetFolder("C:\Test\")

There are no problems, however if I change the directory to the following:

Set folder = fso.GetFolder("C:\Documents and Settings\Bill\My Documents\My Pictures\")

I get a "path not found error" or more specifically:
Microsoft VBScript runtime (0x800A004C)
Path not found
/alpha/UploadFromFolder.asp, line 110

I'm thinking it has something to do with the spaces in the filename since this is really the only difference (besides length).  Does anyone have any suggestions?

Thanks!
0
willy6743
Asked:
willy6743
  • 5
  • 2
  • 2
  • +3
1 Solution
 
willy6743Author Commented:
Looking at this a little further, I found that the path works up to the following point:

Set folder = fso.GetFolder("C:\Documents and Settings\Bill\")

However it is after I try to go another level deeper, I run into the problems.  Is this a security issue?  And if so, how can I get around it so that I can point to the 'My Pictures' folder?

Thanks!
0
 
AsbjornGCommented:
Try this, it's the way windows would want you to write it:


Set folder = fso.GetFolder("""C:\Documents and Settings\Bill\My Documents\My Pictures\""")

Cheers,

Asbjorn
0
 
willy6743Author Commented:
I gave that a try and got the same error message.  It didn't seem to mind the extra quotes but it also did not accept them.

Thanks.
0
The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

 
xiong8086Commented:
use SERVER.URLENCODE("")

Set folder = fso.GetFolder(SERVER.URLENCODE("C:\Documents and Settings\Bill\My Documents\My Pictures\")),

;-)
0
 
AsbjornGCommented:
How about this? (My local setup is bugged, so I'm afraid I can't test myself at the moment)

dim strDir

strDir = "C:\Documents and Settings\Bill\My Documents\My Pictures\"

Set folder = fso.GetFolder(strDir)

Asbjorn
0
 
BAlexandrovCommented:
Yes, it is permissions issue of course! To profile for every user by default have access only this user (and administrators)
Set correct permissions on folder and it will work. You will have to add IUser*** user (or Guests group) to have read or write access or choose different directory.

Bojidar Alexandrov
0
 
TheKenmanCommented:
Set folder = fso.GetFolder("C:\Documents%20and%20Settings\Bill\My%20Documents\My%20Pictures\")
0
 
pillbug22Commented:
I would agree with BAlexandrov.  It is probably a security issue, especially if your web page is running under the default IUSER account (whihc woudn't have access to those foldes unless you specify so).

If you are using Basic or Windows Integrated login, you'll have to make sure the user has access as well.
0
 
willy6743Author Commented:
I will be unable to test until tonight, but I believe you are right with the security issue.  

Is there any way to run a certain page as a user other than IUSER?

I will try setting the IUSER security to this account.  Also, does anyone know of a fast way to change the security settings for a folder without actually going to the properties of the folder and doing this all manually?  Maybe by using a reg file with the registry or with command line commands (maybe a .bat file)?  I was thinking that I would like to have something in the future that will automatically set all of the properties of folders that I am concerned with at once.

I'll reply this evening on what I find out.  Thanks for all of the suggestions!
0
 
pillbug22Commented:
* Is there any way to run a certain page as a user other than IUSER?

If you need anonymous connections available, you can go into IIS and change the user account for the connections (change it from IUSER to another user account).

If you are on an intranet site, you could try using Windows Integrated Login, which passes through the credentials of the user currently viewing the page. (Also true if you use Basic Authentication).


* Also, does anyone know of a fast way to change the security settings for a folder without actually going to the properties of the folder and doing this all manually?

This is possible by using some Windows Scripts, but I think that would probably be best suited for another question (integretiy of EE PAQs)
0
 
willy6743Author Commented:
Great info...Thanks!  And I will post elsewhere for the folder permissions question.
0
 
BAlexandrovCommented:
* Is there any way to run a certain page as a user other than IUSER?
in addition
If you disable anonimous access and enable Basic Authentication and/or Windows Integrated auth you will be asked to authenticate befoer going to page and script will work with your account.

* Also, does anyone know of a fast way to change the security settings for a folder without actually going to the properties of the folder and doing this all manually?
Only will mention that command line utility for that is called "cacls'
0
 
willy6743Author Commented:
Thanks BAlexandrov and pillbug22 for the info.  I'm sure this is the problem so I have accepted BAlexandrov's answer before spending the time to test it.

Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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