wtbonnell Posted January 20, 2005 Posted January 20, 2005 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... Quote
Administrators PlausiblyDamp Posted January 20, 2005 Administrators Posted January 20, 2005 Something like System.IO.FileStream fs; fs = System.IO.File.Open(imgpath, /*other parameters required - can't remember them at the moment and I don't have VS on this PC*/ ) int imageSize = fs.Length; Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
IngisKahn Posted January 20, 2005 Posted January 20, 2005 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; Quote "Who is John Galt?"
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.