Click to See Complete Forum and Search --> : Create Folder


Capricorn
09-30-2003, 10:33 AM
Hi,I have problem creating folder using asp.
I've got the code but it didn't create the folder.Can someone help me fix this asap?Thanks

1)
<html>
<title> user added </title>
<head>

<body>

<form method="post" action="createFolder.asp">
Login ID : <%=Request.Form("login")%><br>
Password : <%=Request.Form("password")%><br>
Click <a href="main.htm">here</a> to proceed.
</form>
</body>

</head>

</html>
-------------------------------------------------
2) createFolder.asp
<%
Dim myFSO
SET myFSO = Server.CreateObject("Scripting.FileSystemObject")

If NOT myFSO.FolderExists("C:\Inetpub\wwwroot\ChProj\" & "login") Then
myFSO.CreateFolder("C:\Inetpub\wwwroot\ChProj\" & "login")

Else
Response.Write "THIS FOLDER ALREADY EXISTS"

End If

SET myFSO = NOTHING
%>

Ribeyed
09-30-2003, 02:09 PM
Hi,
i noticed an error with the syntax for the path/folder name.
I assume that login is a variable and not the name the folder is to be called. If this is the case then the syntax should be this:


<%
Dim myFSO
SET myFSO = Server.CreateObject("Scripting.FileSystemObject")

If NOT myFSO.FolderExists("C:\Inetpub\wwwroot\ChProj\"&login&"") Then
myFSO.CreateFolder("C:\Inetpub\wwwroot\ChProj\"&login&"")

Else
Response.Write "THIS FOLDER ALREADY EXISTS"

End If

SET myFSO = NOTHING
%>

Capricorn
09-30-2003, 10:16 PM
Hi,
I've your method and change the neccessary thing but again,no folder is created in the selected drive.

Which part of my codes is not correct?

Thanks

Ribeyed
10-01-2003, 02:51 AM
hi,

have you checked you have permissions to create a new folder?

does inetpub, wwwroot and chproj folders exsist already?