Forum Moderators: open
I'm trying to check if a folder exists with my ASP code and all that happens is the system just appears to hang i.e. the page just sits there ticking away and never gets anywhere.
This is in a page that has been posted back to itself using a Mode = statement to process different bits of code.
At the top of the page an include is used to control the con.open statement which is as follows:
set con=Server.CreateObject( "ADODB.Connection" )
Set MyBrow=Server.CreateObject("MSWC.BrowserType")
con.Open "file name=c:\Inetpub\wwwroot\example.com\dining.udl"
The code that doesn't want to work is:
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
if MyFileObject.FolderExists("images\menu\Hello") = false then
MyFileObject.CreateFolder("images\menu\Hello")
end if
Once this code is processed the page is then redirected to another page to process a file upload using the response.redirect statement.
Any ideas why this is not working because every search I do about this and the books I have all indicate this is the way it is done.
Thanks
[edited by: Xoc at 1:50 pm (utc) on Nov. 12, 2005]
[edit reason] Changed to use example.com [/edit]
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
if MyFileObject.FolderExists(server.mappath("images\menu\hello")) = false then
response.write "Folder Does Not Exist!<br>"
MyFileObject.CreateFolder server.mappath("images\menu\Hello")
else
response.write "Folder Does Exist!<br>"
end if
If I comment out the createfolder line I get the "Folder does not exist!" message if I remove the \hello off the end of the FolderExists line I get the "Folder does exist!" message (which is correct). It is only when I put the CreateFolder line in that the system just sits and does nothing...
Any help please?
Thanks
Thanks for your help.
I have checked this. Since makingthis post I have done even more fiddling and it now works on my Windows 2000 Advanced Server machine but not on my Windows xp Pro laptop (which is where I do all my development). I'm wondering if there is a different command to use just like CDONTS had to be changed to CDO to work both under XP and W2KAdvSvr.
Any more thoughts?
Thanks.