0
我需要檢索圖像是否存在或不在文件夾路徑中。 我使用下面的代碼:Server.MapPath在mvc中不工作
bool isExists = System.IO.Directory.Exists(Server.MapPath(FolderPath + "Logo.png"));
但是,如果該文件存在布爾變量返回false。
我需要檢索圖像是否存在或不在文件夾路徑中。 我使用下面的代碼:Server.MapPath在mvc中不工作
bool isExists = System.IO.Directory.Exists(Server.MapPath(FolderPath + "Logo.png"));
但是,如果該文件存在布爾變量返回false。
也許你應該使用File.Exists
來代替。
bool isExists = System.IO.File.Exists(Server.MapPath(FolderPath + "Logo.png"));
什麼是'FolderPath'? –
嘗試Path.Combine(folderPath,「Logo.png」) – kkocabiyik
FolderPath是一個字符串,它是圖像的物理路徑。 – user3172321