带有覆盖确认的文件上传 [英] File upload with overwrite confirmation

查看:130
本文介绍了带有覆盖确认的文件上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在使用fileupload()将文件上传到文件夹.
我希望能够检查上传文件夹中是否已存在该文件,并询问用户是否要覆盖现有文件.
我该怎么办?

Hi,

I am using fileupload() for uploading files to a folder.
I want to be able to check if the file already exists in the upload folder and ask the user if wants to overwrite the existing file.
How can I do this?

public void UploadExcel()
    {

        if (FileUpload1.HasFile)
        {


            try
            {

                string folder_from_config = ConfigurationManager.AppSettings["FileUploadFolder"].ToString();

                   FileUpload1.SaveAs(Server.MapPath(folder_from_config) + "\\" + System.IO.Path.GetFileName(FileUpload1.FileName));
                  Session["Input_Data_Excel_File"] =Server.MapPath((folder_from_config) + "\\" + System.IO.Path.GetFileName(FileUpload1.FileName));
            }

            catch (Exception ex)
            {

               // errormsg.Text += "ERROR: " + ex.Message.ToString();
            }

        }
        else
        {

        }}

推荐答案

一个带有"asp.net文件上传并覆盖确认信息"的Google给了我;

http://forums.asp.net/t/1197474.aspx/1 [ ^ ]

该线程显示了实现此目标的不同方法.
A google with "asp.net file upload with overwrite confirmation" gave me;

http://forums.asp.net/t/1197474.aspx/1[^]

The thread shows different ways of achieving this.


尝试
带有覆盖消息的ASP.NET文件上载器 [上传了带有覆盖确认的Asp.net文件 [
Try
ASP.NET File Uploader with Overwrite Message[^]
Asp.net file upload with overwrite confirmation[^]


相信我,我在 ^ ]

上传具有覆盖确认信息的Asp.net文件 [带有覆盖消息的ASP.NET文件上载器 [
Believe me I got these in first page of Google Search[^]

Asp.net file upload with overwrite confirmation[^]
ASP.NET File Uploader with Overwrite Message[^]


这篇关于带有覆盖确认的文件上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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