rito1
asked on
Obtaining File size in MB using System.io
Hi All
Using System.io, how can I obtain the file size in megabytes for the following file:
C:\inetpub\wwwroot\mysite\ test\test. pdf
Many thanks
Rit
Using System.io, how can I obtain the file size in megabytes for the following file:
C:\inetpub\wwwroot\mysite\
Many thanks
Rit
Use the FileInfo class and the length attribute
So that'd be
Dim fi as New FileInfo("C:\inetpub\wwwro ot\mysite\ test\test. pdf")
Dim intSize as Int32 = fi.Length
Dim fi as New FileInfo("C:\inetpub\wwwro
Dim intSize as Int32 = fi.Length
ASKER
thanks both.
cmhunty, that is roughly what I have so far but wondered how I would then change the returning value to MB and really need to round it to 2 decimal places too.
Many thanks in advance
Rit
cmhunty, that is roughly what I have so far but wondered how I would then change the returning value to MB and really need to round it to 2 decimal places too.
Many thanks in advance
Rit
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
sorry shoud be 1024 not 1000
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Brilliant, many thanks.
Rit
Rit