How to get the last modified date of the uploaded file?

后端 未结 2 978
鱼传尺愫
鱼传尺愫 2021-01-22 07:34

I upload an XML file to migrate its contents to my database, but I want firstly store the last modified date of that file to assure that no change has happened to that file from

2条回答
  •  灰色年华
    2021-01-22 08:20

    System.IO.FileInfo object should yield a LastWriteTime property

    FileInfo myFileInfo= new FileInfo(path) ;
    myFileInfo.Refresh();
    string t = myFileInfo.LastWriteTime.ToString("F") 
    

提交回复
热议问题