1             //获得要上传的文件 
2             HttpPostedFile file = Request.Files[0];
3             //获得到文件名
4             string fileName = System.IO.Path.GetFileName(file.FileName.ToString());
5             //获得文件扩展名
6             string fileNameEx = System.IO.Path.GetExtension(fileName);
7             //没有扩展名的文件名
8             string fileNameWithoutExtension = System.IO.Path.GetFileNameWithoutExtension(fileName);

文件和图片是一个道理 通过判断其扩展名来进行处理

相关文章:

  • 2022-12-23
  • 2021-07-19
  • 2022-12-23
  • 2021-12-10
  • 2022-12-23
  • 2021-12-13
  • 2021-09-26
猜你喜欢
  • 2022-12-23
  • 2021-08-24
  • 2021-08-16
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-10
相关资源
相似解决方案