Get file size from a virtual file in EPiServer

VirtualFile file = System.Web.Hosting.HostingEnvironment.VirtualPathProvider.GetFile( CurrentPage["FilePath"].ToString() );
UnifiedFile f = file as UnifiedFile;
return f.Length / 1024 + ” kb”;

Tags: , , ,

  1. Jason McBratney’s avatar

    Exactly what I was looking for. Thanks!

  2. Bastard’s avatar

    Danke!

Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>