Get image size in Kb in asp.net using c#:
Use FileInfo and the Length property to measure file size. Here is the code for get the file size in your C# program easily. The blow sample contain code for get image size in KB and MB.
FileInfo fileInfo = new FileInfo(Server.MapPath("~/Images/Header.jpg"));
double fileSizeKB = fileInfo.Length / 1024;
double fileSizeMB = fileInfo.Length / (1024 * 1024);
double fileSizeKB = fileInfo.Length / 1024;
double fileSizeMB = fileInfo.Length / (1024 * 1024);
0 comments:
Post a Comment
Share your thoughts here...