This is a migrated thread and some comments may be shown as answers.

Dynamically Map Server Folders

5 Answers 56 Views
Upload
This is a migrated thread and some comments may be shown as answers.
Dave Navarro
Top achievements
Rank 2
Dave Navarro asked on 17 Nov 2011, 05:25 PM

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

5 Answers, 1 is accepted

Sort by
0
Tina Stancheva
Telerik team
answered on 22 Nov 2011, 12:26 PM
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 >>

0
Dave Navarro
Top achievements
Rank 2
answered on 22 Nov 2011, 05:04 PM
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
0
Rob
Top achievements
Rank 1
answered on 08 Apr 2012, 01:08 AM
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
0
Alex Fidanov
Telerik team
answered on 09 Apr 2012, 09:46 AM
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 >>

0
Rob
Top achievements
Rank 1
answered on 09 Apr 2012, 10:01 AM
I have implemented a workable solution by pre-creating the folders at the time of creating the parent listing. This works for me.
Tags
Upload
Asked by
Dave Navarro
Top achievements
Rank 2
Answers by
Tina Stancheva
Telerik team
Dave Navarro
Top achievements
Rank 2
Rob
Top achievements
Rank 1
Alex Fidanov
Telerik team
Share this question
or