• Not Answered

Using the $core_v2_cfs.Get API

Hi all,

I'm trying to get the path / url of a file that was uploaded using the site files in System Administration.

I can not get hold of the url / path using the widget API ($fileResponse is always null):

  • #set($fileResponse = $core_v2_cfs.Get("CommunityServer.Components.SelectableAvatars","0c99b8a9.8751.4311.8a61.704040c27014", avatar.png))

However, if  use the REST API, I can get the file data:

I have used the example above as in the developer 5.x documentation as this is the only usable example. 

The files that I'm interested in are located in: communityserver.components.sitefiles\themes.

On a side note, what if my files are located in  communityserver.components.sitefiles, what will the path be?

 

Thanks in advance !

Renier

1 Reply

  • In case anyone else has this issue what I found is that the 'filekey' is the first folder within the filestoreage, and then the folders in the 'filepath' must be separated by hyphens . Also if you have underscores or hyphens in your 'filename' these must be encoded e.g:

    #set($roleIcon = $core_v2_cfs.Get("communityserver.components.roles","ad38b8b2-dcfd-4ed9-b76e-768eff275a2f","my_2D00_role_2D00_icon.png"))

    I found the describe method useful for outputting the file info:

    $core_v2_utility.Describe($roleIcon)

    I did this to handle encoding but it seems very clunky: #set($logoName = $core_v2_utility.Replace($core_v2_utility.Replace(${logoName}, '_', '_5F00_'), '-', '_2D00_'))

    I ended up doing this as none of the encoding methods in the $core_v2_encoding extension would work for me unfortunately.
Related