How to handle file name in System.IO
classes in a cross-platform manner to make it work on Windows and Linux?
For example, I write this code that works perfectly on Windows, however it doesn't create a file on Ubuntu Linux:
var tempFilename = $@"..Datauploads{filename}";
using (FileStream fs = System.IO.File.Create(tempFilename))
{
file.CopyTo(fs);
fs.Flush();
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…