如何判断该路径下是否存在该文件?

lironghai123 2011-03-20 05:27:45
在C#的配置文件中,怎样写?或者在其他地方。怎样写呢?
...全文
184 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Just4life 2011-03-21
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 maco_wang 的回复:]
C# code

if (File.Exists(filePath))//判断文件是否存在
{
Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(LinDown1.Text));
Respon……
[/Quote]

+1
querystringcom 2011-03-21
  • 打赏
  • 举报
回复
if (File.Exists(filePath))
{
存在
}
zhao_shuguang 2011-03-21
  • 打赏
  • 举报
回复
if(new FileInfo(filePath).Exists)
{
存在
}
叶子 2011-03-20
  • 打赏
  • 举报
回复

if (File.Exists(filePath))//判断文件是否存在
{
Response.AddHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(LinDown1.Text));
Response.TransmitFile(filePath);//写到输出流中
}
else
{
Response.Write("不存在该文件");
}
CoCan168 2011-03-20
  • 打赏
  • 举报
回复
if(new FileInfo(filePath).Exists)
{
存在
}
anbin0814 2011-03-20
  • 打赏
  • 举报
回复
if (File.Exists(filePath))
{
存在
}

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧