Having trouble changing the image upload paths...

Last post 04-02-2008, 11:29 PM by Karen. 1 replies.
Sort Posts: Previous Next
  •  03-31-2008, 5:39 PM 38487

    Having trouble changing the image upload paths...

    I am trying to chagne the image upload paths and cant seem to get it to go to a subfolder.  Here is what I am trying to do...

    I have the users recordID stored in a session variable, and so when the user opens a page that the editor control is on, a procedure is called that gets the folder path.  This fuction also checks to see if a folder is located in the "Uploads" folder on my site for them first and will create one if its not there. 

    The function is working because it will create the folder, and set the path to the "Uploads" folder, but for some reason when I open the editor it does not set the user folder as the root.

    Here is code that I am using in the Page_Load event to set the image paths for the current user:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not Page.IsPostBack Then SetEditor()
    End Sub

    Private Sub SetEditor()

    Dim UploadPath As String = Functions.GetUploadFolder(Session("UserID"))

    Me.edit_Content.SetSecurityMediaGalleryPath(UploadPath)
    Me.edit_Content.SetSecurityMaxMediaFolderSize(102400)
    Me.edit_Content.SetSecurityImageGalleryPath(UploadPath)
    Me.edit_Content.SetSecurityMaxImageFolderSize(102400)
    Me.edit_Content.SetSecurityFlashGalleryPath(UploadPath)
    Me.edit_Content.SetSecurityMaxFlashFolderSize(102400)
    Me.edit_Content.SetSecurityFilesGalleryPath(UploadPath)
    Me.edit_Content.SetSecurityMaxDocumentFolderSize(102400)

    End Sub


    Public
    Shared Function GetUploadFolder(ByVal UserID As Integer)

    Dim UploadFolder As String = System.Web.HttpContext.Current.Server.MapPath("~/Uploads/" & UserID)
    If Directory.Exists(UploadFolder) = False Then Directory.CreateDirectory(UploadFolder)
    GetUploadFolder =
    "~/Uploads/" & UserID

    End Function
     
    But when I open the editor the default folder is set to the "Uploads" folder, not the users subfolder (the userID is 2, so the logged in user folder path should be "/uploads/2"):
     
    Any help is greatly appreciated.

    John
View as RSS news feed in XML