Get file properties in ASP.NET

xiaoxiao2021-03-06  123

Www.chinacs.net 2001-8-13 Chinese C # Technology Station

Get file properties in ASP.NET (RETRIEVING FILE Information In ASP.NET)

By Steven Smith

Using ASP.NET We can easily get information about files, including: file name, path, extension, size, and creation and date of use. Below, we take a look at how to obtain the information about the file.

If we use a typical ASP to get file information, it must use the .filesystemobjiect script object to query the information about the file. But in ASP.NET, .filesystemObject is replaced by System.io namespace, in .system.io, it contains a lot of classes that get file system information. One of the classes is Fileinfo, which has information about documents we want to know at any time. Using this class (original use of object), we can completely get many of the information (here, we use the file itself). And using FileInfo can also complete other operations for files, such as backup, rename, and more.

According to the practice, let's see the code first:

FileInfo.aspx <% @ page language = "c #"%>