Announcement

Collapse
No announcement yet.

Get file size using ASP.net

Collapse

Ads on showthread pages

Collapse
This topic is closed.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Get file size using ASP.net

    WordPress Hosting on SSD Servers
    If you want to get the size of a file in ASP.NET (C#), check the below code:
    string MyFile = "~/photos/mymug.gif";

    FileInfo finfo = new FileInfo(Server.MapPath(MyFile));
    long FileInBytes = finfo.Length;
    long FileInKB = finfo.Length / 1024;

    Response.Write("File Size: " + FileInBytes.ToString() +
    " bytes (" + FileInKB.ToString() + " K");
    Last edited by admin; 08-13-2015, 11:52 AM.
Working...
X
Sign up for a News Letter Click here to sign up