Convert bytes to Megabytes in C#
Here is a nice little function to quickly get the size of a file on your server. Great for displaying the size of images in a gallery for example.
private String fnGetImageSize(String sFilePath) { try { System.IO.FileInfo fi = new System.IO.FileInfo(sFilePath); return ConvertBytesToMegabytes(fi.Length).ToString("0.00"); } catch { return "0"; } } static double ConvertBytesToMegabytes(long b) { return (b / 1024f) / 1024f; }

Hi, nice posts there
thank’s for the interesting information