Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Does anyone know how I can get the size of a file (in bytes) that is located on a hard-drive?

 

It is actually an image file (thumbnail). I tried the following below:

 

Bitmap bmp = new Bitmap(imgpath);
int imageSize = bmp.Size;

 

but that size property represents the dimensions. Any ideas?

 

 

Thanks for your help...

Posted

Better yet use FileInfo, it doesn't open the file and can provide you with more info.

 

System.IO.FileInfo fileInfo = new System.IO.FileInfo(imgpath);
int imageSize = fileInfo.Length;

"Who is John Galt?"

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...