Cannot convert IFormfile to string

Viewed 661

I am trying to read a zip file with I get via IFormFile and I am going through the files inside to unzip a selected extension and unzip it but I cannot use the IFormFile to read it. It says cannot convert IFormFile to string.

Any suggestions on how to tackle this?

using (ZipArchive archive = ZipFile.OpenRead(file))
{
    foreach (ZipArchiveEntry entry in archive.Entries)
    {
       if (entry.FullName.EndsWith(".dbf", StringComparison.OrdinalIgnoreCase))
       {
         RedirectToAction("Index");
       }
    }
}
1 Answers

Because IFormFile != string. I guess OpenRead expects a file path.

So, first read the content of the IFormFile into a file, then use that file path.

Related