Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • rajeev 18 posts 38 karma points
    Feb 01, 2011 @ 06:20
    rajeev
    0

    Get File Size of a uploaded item

    there is a property in one document of type upload, I am able to show the file path in xslt but I don't know how to show the size of this uploaded file. I tried to use the C# script in the xslt using FileInfo class . But  I don't get  the access to this class becouse in xslt we can use only static method. Static method   does not allow to use this class and server.mappath. Please help to solve this issue. I am not sure what i should do know.

    Thanks in advance

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Feb 01, 2011 @ 08:29
    Hendy Racher
    1

    Hi Rajeev,

    There are a couple of ways you can solve this:

    Adding a property called 'umbracoBytes' as a label to the same Document Type as the upload property. The file upload property should should pre-populte this label with the file size.

    Creating a static c# wrapper method that internally uses the FileInfo class.

    HTH,

    Hendy

  • rajeev 18 posts 38 karma points
    Feb 01, 2011 @ 11:39
    rajeev
    0

    Manulaly adding filesize to label each time is not the best way, I think...

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Feb 01, 2011 @ 12:16
    Hendy Racher
    0

    Hi Rajeev,

    Using the 'umbracoBytes' label is an automatic process.

    Cheers,

    Hendy

Please Sign in or register to post replies

Write your reply to:

Draft