Adsence750x90

Tuesday, November 25, 2008

How to get size of a file using asp.net and C#

How to get size of a file using asp.net and C#?

here is the solution.
this function return the size of the file in MB
private double fileSize(FileUpload file)
{
long KB = file.FileBytes.LongLength / 1024;
double MB = (double)KB / 1024;
return MB;
}

No comments: