Cross-platform file name handling in .NET Core
<p>How to handle file name in <code>System.IO</code> classes in a cross-platform manner to make it work on Windows and Linux?</p>

<p>For example, I write this code that works perfectly on Windows, however it doesn't create a file on Ubuntu Linux:</p>

<pre><code>var tempFilename = $@"..\Data\uploads\{filename}";
using (FileStream fs = System.IO.File.Create(tempFilename))
{
    file.CopyTo(fs);
    fs.Flush();                    
}
</code></pre>