Can someone explains how to display the filesize of an uploaded document. I have an upload field where client can upload either a pdf or doc file, but now i want to display the filesize of the doc as well.
Hi Lee, yes i added $fileSize just to see what was the value being output. Just for the record am not displaying docs from media section, am uploading the file from the Content Node itlself, but cant get the actual filesize.
FileSize when uploading pdf
Can someone explains how to display the filesize of an uploaded document. I have an upload field where client can upload either a pdf or doc file, but now i want to display the filesize of the doc as well.
Here is how am doing it in my xslt
Maybe wire up an ICustomFormatter like this one as an XSLT extension?
http://flimflan.com/blog/FileSizeFormatProvider.aspx
Hi Fuji,
You know what I'm going to say already... uComponents to the rescue! Ta-dah!
In the IO XsltExtension, there is a method called FormatFileSize ... pass the "umbracoBytes" property into that, it will return you a pretty filesize.
Cheers, Lee.
Hi. I must have misunderstood but what's wrong with your code? For the first look it should work for any file stored in Media.
Fuji, I agree with Rodion - your original XSLT snippet looks right and would work (apart from you are displaying the "$fileSize" twice).
I was offering an alternative option - absolutely nothing wrong with doing this in your XSLT.
Cheers, Lee.
Hi Lee, yes i added $fileSize just to see what was the value being output. Just for the record am not displaying docs from media section, am uploading the file from the Content Node itlself, but cant get the actual filesize.
is working on a reply...