且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用ASP.NET和C#获取文件名和文件路径

更新时间:2023-02-23 18:32:26

亲爱的朋友,

获取文件名
Dear Friend,

Get File name
string fileName = @"C:\mydir\myfile.ext";
string path = @"C:\mydir\";
string result;

result = Path.GetFileName(fileName);
Console.WriteLine("GetFileName(''{0}'') returns ''{1}''", 
    fileName, result);

result = Path.GetFileName(path);
Console.WriteLine("GetFileName(''{0}'') returns ''{1}''", 
    path, result);



请参考此链接,其中包含与您相同的问题并已解决:-

如何在数据库中保存图像路径使用asp.net [ ^ ]


谢谢



Please refer to this link which contains the same question as yours and solved:-

how to save path of image in database using asp.net[^]


Thanks