FileItem vs PathItem

Last post 12-21-2013, 6:19 PM by frJericho. 4 replies.
Sort Posts: Previous Next
  •  12-09-2013, 3:15 PM 78540

    FileItem vs PathItem

    I wrote a custom FileProvider for CuteEditor 6 which works perfectly and I'm trying to convert it for RichTextEditor 8. 

     

    The main problem I have is that the new PathItem class returned by the GetFiles method has a "Name" property but doesn't have a URL like the FileItem had in CE 6. This is a problem for me because some of my files have cryptic physical names like "aad034xsfd4.txt" but I want to display a user-friendly name. I was able to do this very easily in CE 6

    1. var file = new FileItem()  
    2. {  
    3.       Name = "Letter from the CEO",  
    4.       Url = "aad034xsfd4.txt"  
    5. };  

    The friendly name would be displayed to my users but the URL would be used to retrieve the content of the file. This doesn't seem to be possible anymore in RTE 8. Am I correct?

     
  •  12-09-2013, 10:37 PM 78548 in reply to 78540

    Re: FileItem vs PathItem

    Dear frJericho , 

     

    RTE8's file provider is changed for supporting the multiple storage . 

     

    And file url is joined at client side , by 3 parts :

     

    1 - public override string GetUrlPrefix(Storage zone) of the custom EditorFileProvider 

        for example , "/uploads" ,  "/download.ashx?file="

    2 - public override string GetUrlPath(FolderID folderid) of the custom EditorFileProvider 

       for example , "/" , "/subfolder/" 

    3 - PathItem.Name

       for example "hello.jpg" 

     

    so the full url is  /download.ashx?file=/subfolder/hello.jpg 

     

    If you implement something like download.ashx for it , it need to parse the /subfolder/hello.jpg , and find the real file data to download.

     

    Regards,

    Terry

     

  •  12-10-2013, 9:58 AM 78566 in reply to 78548

    Re: FileItem vs PathItem

    Thanks for the explanation. The three steps you describe make a lot of sense to determine an item's full URL but we are still missing a way to display a user-friendly name to the user. In the example I gave you earlier, I want to be able to display "Letter from the CEO" to the user when the name of the file in question is "aad034xsfd4.txt"

     

    And my final point that I would like to emphasize is: this was possible with CE 6, we seem to have lost this feature in RTE 8.

     
  •  12-20-2013, 11:27 AM 78647 in reply to 78566

    Re: FileItem vs PathItem

    Dear frJericho , 
     
    We have add an new property to the PathItem
     
    you can use pathitem.Text = "display name" to let it override the pathitem.Name 
     
    if the pathitem.Text is not specified , the pathitem.Name will be displayed.
     
    Please download the last version and try it . 
     
    Regards,
    Terry
     
  •  12-21-2013, 6:19 PM 78654 in reply to 78647

    Re: FileItem vs PathItem

    This is exactly what I needed and it works exactly the way I wanted.

     

    Thanks Terry.  

View as RSS news feed in XML