Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating folders and subfolders on the fly

Status
Not open for further replies.

cyberbob2

Programmer
Nov 13, 2003
32
US
I am able to create folders and subfolders with ASP with this:
<%
set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
' name your folder
dim basefolder
basefolder = &quot;testing&quot;
sub createfolders()
' create root folder
objFSO.CreateFolder (&quot;c:\Inetpub\ & basefolder)
' create subfolders
objFSO.CreateFolder (&quot;c:\Inetpub\ & basefolder & &quot;\css&quot;)
objFSO.CreateFolder (&quot;c:\Inetpub\ & basefolder & &quot;\img&quot;)
objFSO.CreateFolder (&quot;c:\Inetpub\ & basefolder & &quot;\inc&quot;)
objFSO.CreateFolder (&quot;c:\Inetpub\ & basefolder & &quot;\js&quot;)
end sub
createfolders()
Response.write(&quot;all folders created&quot;)
set objFSO = nothing
%>

However, what I am trying to do is take in a parameters from user input from text boxes on my web page. So, if the user enters 1234 in the Order# textbox, then attaches a file to upload, then clicks submit, a folder named 1234 will be created on the fly and the uploaded file saved in that folder. If the user enters 1234 in the Order# textbox, then 01 in the Version# textbox, a folder named 1234 AND a subfolder named 01 is created, with the uploaded file saved in both.

I already have the upload piece working, I just need to take in these parameters and save it to these folders/subfolders.

Hope this makes sense. Thanks in advance,
Bob
 
You would use something similar to this
Code:
<%
If Request.Form(&quot;OrderNumber&quot;) <> &quot;&quot; Then
    Dim FolderName
    FolderName = CStr(Request.Form(&quot;OrderNumber&quot;))
    objFSO.CreateFolder (objFSO.CreateFolder _
       (&quot;c:\Inetpub\[URL unfurl="true"]wwwroot\&quot;[/URL] & FolderName))
    If Request.Form(&quot;VersionNumber&quot;) <> &quot;&quot; Then
        Dim Version
        Version = CStr(Request.Form(&quot;VersionNumber&quot;))
        objFSO.CreateFolder (objFSO.CreateFolder _
          (&quot;c:\Inetpub\[URL unfurl="true"]wwwroot\&quot;[/URL] & FolderName & &quot;\&quot; & Version))
    End If
End If
%>

This assumes that you you the &quot;post&quot; method for your form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top