如何使用文件uipload控件跳过异常 [英] how to skip an exception whan using file uipload control

查看:78
本文介绍了如何使用文件uipload控件跳过异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用文件上传控件上传文件,



当文件已经存在于目标文件夹中时会引发异常,如何跳过该异常?





i需要我的程序在该函数中运行其余代码

解决方案

如果有异常,那么代码中就有问题。为什么不用catch?参见本页:

http://www.ezineasp.net/post/ASP-Net-File-Upload-Example-using-C-sharp-code.aspx [ ^ ]


< blockquote>为什么不删除/移动它存在的早期文件





http://stackoverflow.com/questions/6391711/c-sharp-how-to-delete -a-file-eg-if-exist-delete-xxxxxxxx [ ^ ]

如何删除c#中的文件? [ ^ ]



或者

查看上传文件的其他方法



fileupload示例 [ ^ ]

i'm using file upload control to upload a file ,

when file already exists in destination folder an exception is raised how to skip that exception?


i need my program to run the rest of the code with in that function

解决方案

If there is an exception, then there is something wrong in your code. Why not use catch? See this page:
http://www.ezineasp.net/post/ASP-Net-File-Upload-Example-using-C-sharp-code.aspx[^]


why dont you delete/move the earlier file it exists


http://stackoverflow.com/questions/6391711/c-sharp-how-to-delete-a-file-e-g-if-exist-delete-xxxxxxxx[^]
How to delete file in c#?[^]

or
have a look to other methods to upload files

fileupload examples[^]


这篇关于如何使用文件uipload控件跳过异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆