Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I can get the full path to a media file using
umbraco.library:GetMedia(./data [@alias = 'downloadFile'], 0)/data [@alias = 'umbracoFile']
which works and is good for the actual link, but i want to display just the filename - myfile.pdf
rather than the full path media/3455/myfile.pdf
How do i get just the filename segment?
thanks
Here's an idea...probably not the cleanest way but it works. Basically uses the Replace function to replace "/media/<nodeid>/" with nothing
<xsl:value-of select="umbraco.library:Replace(umbraco.library:GetMedia(./data [@alias = 'slideImage'], 0)/data [@alias = 'umbracoFile'], concat('/media/', ./data[@alias = 'slideImage'],'/'),'')"/>
You can also just use the node name:
<xsl:value-of select="@nodeName" />
Assuming you've named the node the same as your file.
-Paul
in addition to Paul's suggestion I have also had to remove the extensions some times (which is added automatically if you use the multiple upload tool).
I do this by:
<xsl:variable name="extension">.<xsl:value-of select="./data[@alias='umbracoExtension']"/></xsl:variable> <xsl:variable name="theTitle" select="Exslt.ExsltStrings:replace(@nodeName, $extension, '')"/>
Cheers
Paul
I have used the following snippet to get the node name of an uploaded image in the Media section
<xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/image, 0)" /><img src="{$media/umbracoFile}" alt="{$media/@nodeName}"/>
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
How do I get just the filename segment of an umbraco media file?
I can get the full path to a media file using
umbraco.library:GetMedia(./data [@alias = 'downloadFile'], 0)/data [@alias = 'umbracoFile']
which works and is good for the actual link, but i want to display just the filename - myfile.pdf
rather than the full path media/3455/myfile.pdf
How do i get just the filename segment?
thanks
Here's an idea...probably not the cleanest way but it works. Basically uses the Replace function to replace "/media/<nodeid>/" with nothing
<xsl:value-of select="umbraco.library:Replace(umbraco.library:GetMedia(./data [@alias = 'slideImage'], 0)/data [@alias = 'umbracoFile'], concat('/media/', ./data[@alias = 'slideImage'],'/'),'')"/>
You can also just use the node name:
Assuming you've named the node the same as your file.
-Paul
in addition to Paul's suggestion I have also had to remove the extensions some times (which is added automatically if you use the multiple upload tool).
I do this by:
Cheers
Paul
I have used the following snippet to get the node name of an uploaded image in the Media section
is working on a reply...