title: File upload occurs too soon
body: <p>I am uploading a file but before that, I am checking end deleting files in the upload directories.
  The issue is that the upload occurs faster than the deletion of files.</p>
  <pre><code> public IActionResult Upload(FixedNgaExisting model, IFormFile file)
          {
              
  
              //check if files exist in upload directory
              //empty the folder if it's not empty
              DirectoryInfo dir = new DirectoryInfo(path);
              if (!System.IO.File.Exists(path))
              {
                  foreach (FileInfo fFile in dir.GetFiles())
                  {
                      fFile.Delete();
                  }
              }
  
              
              
                  using (ZipArchive archive = ZipFile.OpenRead(fileName))
                  {
                      foreach (ZipArchiveEntry entry in archive.Entries)
                      {
                          if (entry.FullName.EndsWith(&quot;.dbf&quot;, StringComparison.OrdinalIgnoreCase))
                          {
                              string destinationPath = Path.GetFullPath(Path.Combine(extractPath, entry.Name));
  
                              //extraxt the &quot;.dbf&quot; file to directory
                              if (destinationPath.StartsWith(extractPath, StringComparison.Ordinal))
                                  entry.ExtractToFile(destinationPath);
  
                          }
                      }
                  }
          }
  </code></pre>
  <p>How should I delay the upload? Or how should I execute the deletion first and then proceed to the upload?</p>