Dynamically Map Server Folders

6 posts, 0 answers
  1. Dave Navarro
    Dave Navarro avatar
    150 posts
    Member since:
    Jul 2005

    Posted 17 Nov 2011 Link to this post

    Hello everyone,

    I'm planning to use radUpload in my project but I'm wondering how to map my upload directory to my App_Data folder. We have different companies using our application and I wish to dynamically set the folder that they'll use with the App_Data folder.

    Does anyone have a code snippet they can share for setting this in the code-behind?

    Please let me know and thanks,

    ~ Dave

  2. Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 22 Nov 2011 Link to this post

    Hello Dave,

    I'm posting the KB article I pointed you to in the support ticket, just in case, other encounter the same issue:

     Customize the Upload Storage - the article describes an approach for implementing such a scenario.

    Greetings,
    Tina Stancheva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Dave Navarro
    Dave Navarro avatar
    150 posts
    Member since:
    Jul 2005

    Posted 22 Nov 2011 Link to this post

    Hello,

    I implemented an easy fix which surprised me. I've asked (via my support ticket) if this was an accceptable method and was told yes, so I can't help wonder how I missed it the first time.

    In any case, what I'm doing is; I've setup some properties in my app.xaml.cs that act as session variables for my SL4 project. After the user logs into the app (started with the MS Business Template) I simply populate the properties as needed.

    One of them is called app.strServerName. So, in my code behind for the file that has the radUpload control on it I simply set the TargetFolder property like this; this.radUpload.TargetFolder = "App_Data/Alpha/" + app.strServerName + "/India/Echo";

    This allows me to have a dynamic folder structure within my App_Data folder. Each company can have their own parent folder name and I keep the folder names in a table on the server which holds our authentication db. Which of course is the one provided by the Business Template from the start.

    I can now add new server names as needed when new companies sign up to use our application. And by keeping the information in the authentication db I can keep it nice and organized in one place. If I need to change their folder name I can make the change in one place and the users will get redirected the next time they log in.

    Anyway, that's what I did. I hope this helps someone down the road.

    Take care,

    ~ Dave
  5. Rob
    Rob avatar
    9 posts
    Member since:
    Aug 2011

    Posted 07 Apr 2012 Link to this post

    I can also change the TargetUrl from code behind in Silverlight without problem. However, if the folder does not exist on the Web Server, I would like to dynamically create it.

    I thought that creating a Constructor in my handler would do the trick but even though the code reaches here (I created a simple breakpoint) the value of TargetUrl at this point is null.

    Is there a way of checking the target folder on the ASP.NET side and creating it dynamically?

    Thanks,
    Rob
  6. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 09 Apr 2012 Link to this post

    Hello Rob,

     The Target(Physical)Folder property is a virtual one, so you can override it and manually determine the destination folder. Please let me know if that is acceptable in your scenario?

    Greetings,
    Alex Fidanov
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  7. Rob
    Rob avatar
    9 posts
    Member since:
    Aug 2011

    Posted 09 Apr 2012 Link to this post

    I have implemented a workable solution by pre-creating the folders at the time of creating the parent listing. This works for me.
Back to Top
DevCraft banner