Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Page Hangs When Trying To...

Recommended Posts

I am trying to create a file on my server / localhost but when I run the script below the page starts loading and then eventually times out.

Code:Dim myFSO'this line creates an instance of the File Scripting Object named myFSOSET myFSO = Server.CreateObject("Scripting.FileSystemObject")'error handling here to make sure that things go smoothly'if the file does not exist If NOT myFSO.FileExists("C:\Inetpub\wwwroot\BMS\myNewText.txt") Then'then we create it on this drive in the path we specifymyFSO.CreateTextFile("C:\Inetpub\wwwroot\BMS\myNewText.txt")Else'otherwise we tell the client it does so they don't get a nasty errorResponse.Write "THIS FILE ALREADY EXISTS"End If'this line destroys the instance of the File Scripting Object named myFSOSET myFSO = NOTHING

any help will be much appreciated

Notice from serverph:
code enclosed in correct tags.

Edited by serverph (see edit history)

Share this post


Link to post
Share on other sites

Hi kavernexpress,
Just a suggestion... er question.
What is the necessity for the "NOT" in the
If... then...else
statement?
re:

If NOT myFSO.FileExists("C:\Inetpub\wwwroot\BMS\myNewText.txt") Then

Is this correct syntax? Seems odd.Maybe you could try this logic sequence...
If... 'the file exists
then...'default to exit/ or ignore
else...' create the file
RGPHNX

Share this post


Link to post
Share on other sites

If I were you I'd add some debug messages (just print to the screen) to see where it hangs. Are you sure you are allowed to create new files on the server with your script?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.