In asp.net forum I have got this question many times like this, "How to get File size" or "How to get File Length". For this today I want to share with you how to get the file size in asp.net. Its very simple but helpful...
Code:C#
Add namespace:
Using System.IO;
string sMyFileName = "~/photos/test.jpg";
FileInfo finfo = new FileInfo(Server.MapPath(sMyFileName ));
long FileInBytes = finfo.Length;
long FileInKB = finfo.Length / 1024;
long FileInMB = FileInKB /1024;
Response.Write("File Size: " + FileInBytes.ToString() +
" bytes (" + FileInMB.ToString() + " MB)");
Sharing real-world experiences about C#, Dynamics CRM, Dynamics 365, Dynamics NAV/Business Central, SharePoint,PowerBI,ASP.net and more...
Subscribe to:
Post Comments (Atom)
Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'
Exception: Method 'StartWorkflowOnListItem' in type 'Microsoft.SharePoint.WorkflowServices.FabricWorkflowInstanceProvider'...
-
The CheckBoxList control in ASP.NET 2.0 is one of the useful control for asp.net developer. But it is not so easy(also not complicated :))to...
-
There are various ways to use Single Sign on(SSO) in asp.net web application. We can use cookies, session (state server), SAML and web serv...
-
Problem: Today I have faced a new problem(new for me), when I press save button it works fine and then refresh(F5 or Refresh button on brow...
1 comment:
Its working.
Post a Comment