kvarnerexpress 0 Report post Posted April 17, 2005 (edited) 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 April 17, 2005 by serverph (see edit history) Share this post Link to post Share on other sites
RGPHNX 0 Report post Posted April 17, 2005 Hi kavernexpress,Just a suggestion... er question.What is the necessity for the "NOT" in the If... then...elsestatement?re: If NOT myFSO.FileExists("C:\Inetpub\wwwroot\BMS\myNewText.txt") ThenIs this correct syntax? Seems odd.Maybe you could try this logic sequence...If... 'the file existsthen...'default to exit/ or ignoreelse...' create the fileRGPHNX Share this post Link to post Share on other sites
bjrn 0 Report post Posted April 22, 2005 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