Calculate Size of a particular file


#1

HI,

In my scenario I want to upload a document using Browse button and providing path of the file.

But upload portal has a limitation that we can not upload a document whose size is greater than 2MB. Is there any way by which we can calculate the file size before uploading? The document is mostly in PDF or JPEG format.

Thanks in advance… :slight_smile:


#2

Hey @mgangrade7

FileInfo.Length will return the length of file, in bytes (not size on disk), so this is what you are looking for, I think.

If you have already a file path as input, this is the code you need:

long length = new System.IO.FileInfo(path).Length;

Regards…!!
Aksh


Get file size
#3

What abt directory size?


#4

Yes you can calculate that as well. Singel level like below :slight_smile:
Get The Directory Size_at_single_level.xaml (6.6 KB)

Regards…!!
Aksh


#5

How can we retrieve drive details


#6

Hey @ndivya

Check the existing thread and let me know:

Regards…!!
Aksh