我正在开发一个网站,其中客户端上传一些文档文件,如doc,docx,htm,html,txt,pdf等.我想检索上传文件的最后修改日期.我创建了一个处理程序(.ashx)来完成保存文件的工作.
Following is the code:
HttpPostedFile file = context.Request.Files[i];
string fileName = file.FileName;
file.SaveAs(Path.Combine(uploadPath, filename));
Run Code Online (Sandbox Code Playgroud)
如您所见,使用file.SaveAs()方法保存文件非常简单.但是这个HttpPostedFile类没有暴露任何属性来检索文件的最后修改日期.
那么有人能告诉我如何在将文件保存到硬盘之前检索文件的最后修改日期吗?