So, I'm trying to display the location of some file - .doc or .xls, maybe even .html - that's been uploaded to somewhere in Media and linked to using the Media Picker. So, I've got this line of code:
The extra doc is the file type and the 1294336 is the file size. That's nice to know, but I'd prefer if I could display just the location so I can place that line inside an href and have someone right-click and download the file.
What I don't understand is that I can do this sort of thing with the Content Picker and NiceUrl:
That's it! So, I presume by extension that if you were so inclined, you could aslo get the file size and/or file type? Because now that I know that, I'm certain to want to.
Yeah, you can grab all of the properties from the media node, just lige the umbracoFile. Just do it the same way, but change the alias'es on the fields. Should work like a charm :)
Display GetMedia Content in Template
So, I'm trying to display the location of some file - .doc or .xls, maybe even .html - that's been uploaded to somewhere in Media and linked to using the Media Picker. So, I've got this line of code:
And what that gives me is close, but not quite:
The extra doc is the file type and the 1294336 is the file size. That's nice to know, but I'd prefer if I could display just the location so I can place that line inside an href and have someone right-click and download the file.
What I don't understand is that I can do this sort of thing with the Content Picker and NiceUrl:
So, any ideas would be appreciated. I didn't see this exact thing anywhere in the forums. We're running 4.6.
Hi Brenton
I found some part of code is missing in your code. Please try this
<a href="<umbraco:Item field='documentationLocation' xslt='umbraco.library:GetMedia({0},true())/umbracoFile' xsltDisableEscaping='true' runat='server' />">My Media</a>
That's it! So, I presume by extension that if you were so inclined, you could aslo get the file size and/or file type? Because now that I know that, I'm certain to want to.
Hi Brenton
Yeah, you can grab all of the properties from the media node, just lige the umbracoFile. Just do it the same way, but change the alias'es on the fields. Should work like a charm :)
/Kim A
is working on a reply...