0

I have two dates from and until and I want to add the filter on the file upload button:

<asp:FileUpload ID="FileUpload1" runat="server" CssClass="btn" style="background-color: #d19629;"
accept=".csv" />

If I click on that FileUpload button show only those files that are in my date range, is it possible?

Selim Yildiz
  • 5,254
  • 6
  • 18
  • 28

1 Answers1

0

If I understand you correctly, you can't do that. What you can do is that check file creation date(or modification date) on FileUpload click event:

 System.IO.FileInfo fileInfo = new System.IO.FileInfo(UPLOAD_DIRECTORY + FileUpload1.FileName);
 if(fileInfo.CreationTime > ... &&   fileInfo.CreationTime < ...) //check document creation date
 {
    //..
 }
 else
 {
   //the file is not in date range
 
 }

See also: How to get File Created Date and Modified Date

Selim Yildiz
  • 5,254
  • 6
  • 18
  • 28