ASP. Gets the modified time in the file properties, the method of obtaining the system file attributes, the last write time
1 #regionGet the detailed properties of the file, size, date modified, location, etc.2 /// <summary>3 ///get the detailed properties of the file, size, date modified, location, etc.4 /// </summary>5 /// <param name= "Files" >path to the file</param>6 /// <returns></returns>7 Public stringGetFileInfo (stringfiles)8 {9 stringresult ="";Ten if(!string. IsNullOrEmpty (Files)) One { A stringPath =Server.MapPath (files); - if(!System.IO.Directory.Exists (path)) - { theSystem.IO.FileInfo FileInfo =NewSystem.IO.FileInfo (path); -Result + ="Detailed path:"+Fileinfo.fullname -+"<br> file name:"+Fileinfo.name -+"<br> file Length:"+fileInfo.Length.ToString () ++"bytes <br> creation time"+fileInfo.CreationTime.ToString () -+"<br> Last access time:"+fileInfo.LastAccessTime.ToString () ++"<br> modification Time:"+fileInfo.LastWriteTime.ToString () A+"<br> Directory:"+Fileinfo.directoryname at+"<br> Extension:"+fileinfo.extension; - } - } - returnresult; - } - #endregion
Get the detailed properties of the file, size, date modified, location, etc.