Pragmatically create a new folder

Results 1 to 4 of 4

Thread: Pragmatically create a new folder

  1. #1
    Brian Hammer Guest

    Default Pragmatically create a new folder

    I am not sure if it can be done or not but what I would like to accomplish is to have a new folder automatically be created when a user adds information to a database. What I want to do is when the user saves the information to the database, it pulls information from the "Manufacture","ModelType" and "AircraftModel" fields and creates a new folder on the<BR>webserver under<BR>wwwrootspecificationsspecificationsfieldf ieldfieldimagesfolder<BR><BR>Any help is greatly appreciated<BR>Regards,<BR>Brian Hammer<BR><BR>InetPub/WWWRoot/Specifications/Specifications/&#060;%=Session("Manufacture")%&#062;/&#060;%<BR>=Session("ModelType")%&#062;/&#060;%=Session("AircraftModel")%&#062;/Images/

  2. #2
    Join Date
    Dec 1969

    Default, FAQ # 109

    "How can I create a folder (directory) on the Web server?"<BR><BR><BR>Happy Programming!

  3. #3
    Brian Hammer Guest

    Default RE:, FAQ # 109

    Thanks for the reply, I have gotten that far so far but I am having a problem using a variable to specify the foler path. Any help would be great. I am a newbi programmer so please bear with me. This is what I have so far:<BR><BR>&#060;%Option Explicit%&#062;<BR>&#060;%<BR>Dim MainFolder<BR>Dim SubFolders<BR>Dim SubFolder<BR>&#039;need to change to the mapped network drive<BR>Const Drive = "C"<BR>&#039;Figure out how to get the database fields into the "FolderPath"<BR><BR>Function BuildImageDirectory(FSO)<BR>&#039;Bail out if the drive does not exist.<BR> If Not FSO.DriveExists(Drive) Then<BR> BuildImageDirectory = False<BR> Exit Function<BR> End If<BR>&#039;Create the main folder and subfolder ***THIS IS THE PROBLEM****<BR>Set MainFolder = FSO.CreateFolder(session("Manufacture"))<BR> Set SubFolders = MainFolder.SubFolders<BR> Set SubFolder = SubFolders.Add(session("AircraftModel"))<BR> BuildImageDirectory = True<BR>End Function<BR>Sub Main<BR> Dim FSO<BR> Set FSO = CreateObject("Scripting.FileSystemObject")<BR> If BuildImageDirectory(FSO) Then <BR> Response.Write "Folder created for the photographs"<BR> Else <BR> Response.Write "Photograph folder already exists or cannot be created."<BR> Exit Sub<BR> End If<BR>End Sub<BR>Main<BR>%&#062;

  4. #4
    Brian Hammer Guest

    Default RE:, FAQ # 109

    Ohh, and to add to this, using the session variable, I get an error in IE5 Microsoft VBScript runtime (0x800A0005)<BR>Invalid procedure call or argument<BR>/Specifications/test.asp, line 24<BR><BR>But I can easily hard code in the path and it will work every time.<BR><BR>Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts