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

Image Path Problem

6 Answers 188 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Naadir
Top achievements
Rank 1
Naadir asked on 24 Jul 2008, 03:25 PM
Hi,

I'm setting my image path locations dynamically in code.
I create a folder according to the current month and year and set it as my UploadPath. and set the root of the folder i create as the Image and Delete paths.

The problem is that i can upload to the directory specified but i cannot navigate to the directory I set as the Image path. So if my upload path is \images\2008\07 i am only able to navigate to the 2008 folder. The paths are located in another virtual directory in my localhost.
I'm currently using RadEditor Ver 7.0.0.0
Please see code below:

        string[] path = { ConfigurationManager.AppSettings["ImageAssets"] }; 
        string[] dir = { Server.MapPath(path[0]) + "\\" + DateTime.Now.Year.ToString() + "\\" + DateTime.Now.ToString("MM") }; 
        if (!System.IO.Directory.Exists(dir[0])) 
        { 
            System.IO.Directory.CreateDirectory(dir[0]); 
        } 
        FullTextEditor.ImagesPaths = path; 
        FullTextEditor.DeleteImagesPaths = path; 
        path[0] = path[0]+ "\\" + DateTime.Now.Year.ToString() + "\\" + DateTime.Now.ToString("MM"); 
        FullTextEditor.UploadImagesPaths = path; 

6 Answers, 1 is accepted

Sort by
0
Naadir
Top achievements
Rank 1
answered on 24 Jul 2008, 03:27 PM
Sorry.. posted in the wrong thread :) Please move to RadControl for ASP.NET one. Thanks
0
George
Telerik team
answered on 28 Jul 2008, 12:01 PM
Hi Naadir,

I tested the provided code and everything on my side worked fine - please find attached a sample video that demonstrates my test, along with my code. Are you able to reproduce the problem using the provided files? If yes, please open a support ticket and send us a sample runnable project where the problem can be observed. We will check it and do our best to provide a solution.

I hope this helps.

Sincerely,
George
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Naadir
Top achievements
Rank 1
answered on 28 Jul 2008, 01:12 PM
Thanks for the response, however it doesn't solve my problem.

If you look at the video from 42 seconds onwards. Everything works fine on my side until that point where a user can only upload to the folder in img/2008/07/. The problem is the user must be able to navigate to the "img" folder. In the frame at 42 sec I want to be able to navigate to "2008" and "img". Funny thing is if i set the paths they way i want to work in the aspx page then it works fine.

In the code FullTextEditor.ImagesPath = path
and FullTextEditor.DeleteImagesPath = path
should be set to /RadEditor7.0.2/Img
and the UploadPath to /RadEditor7.0.2/Img/2008/07
0
George
Telerik team
answered on 30 Jul 2008, 08:47 AM
Hi Naadir,

You can easily achieve the desired behavior by modifying your code as follows:
protected void Page_Load(object sender, EventArgs e)  
{  
    string[] path = { ConfigurationManager.AppSettings["ImageAssets"],"" };    
    string[] dir = { Server.MapPath(path[0]) + "\\" + DateTime.Now.Year.ToString() + "\\" + DateTime.Now.ToString("MM") };    
    if (!System.IO.Directory.Exists(dir[0]))    
    {    
        System.IO.Directory.CreateDirectory(dir[0]);    
    }    
    FullTextEditor.ImagesPaths = path;    
    FullTextEditor.DeleteImagesPaths = path;    
      
    path[1] = path[0]+ "\\" + DateTime.Now.Year.ToString() + "\\" + DateTime.Now.ToString("MM");    
    FullTextEditor.UploadImagesPaths = path;    
 

Note that, in order a directory to be browsable using the ImageManger dialog it should be included into the ImagesPaths collection - by doing this, you may restrict the browsable directories.

Kind regards,
George
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Naadir
Top achievements
Rank 1
answered on 12 Aug 2008, 09:18 AM
Hi,

The solution below is almost working. Although it still allows the user to upload to the path[0]. Is there a work around this?

Regards,
Naadir
0
George
Telerik team
answered on 13 Aug 2008, 12:17 PM
Hi Naadir,

In order to achieve the desired behavior you should modify your code so that the Root directory to be added only to the ImagesPaths collection. Now it is added to the ImagesPathsDeleteImagesPaths and UploadImagesPaths collections.


I hope this helps.

Kind regards,
George
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Naadir
Top achievements
Rank 1
Answers by
Naadir
Top achievements
Rank 1
George
Telerik team
Share this question
or