Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting filesize from OpenFileDialog?

How can I get the filesize of the currently-selected file in my Openfiledialog?

like image 257
Mary Avatar asked Aug 24 '09 11:08

Mary


1 Answers

You can't directly get it from the OpenFieldDialog.

You need to take the file path and consturct a new FileInfo object from it like this:

var fileInfo = new FileInfo(path);

And from the FileInto you can get the size of the file like this

fileInfo.Length

For more info look at this msdn page.

like image 182
Alex Shnayder Avatar answered Sep 28 '22 02:09

Alex Shnayder