FileSystem.CopyFile 用户操作

发布于 2024-12-25 22:56:59 字数 549 浏览 6 评论 0原文

我有一个 MVC3 C#.Net Web 应用程序。在我的 HTML 视图中,我使用标准 Windows 文件输入

<input style="border:thin solid #ccc;width:270px; background-color: #FFFFFF;" type="file" name="Name" id="Name"/>

在控制器中,我使用 Microsoft.VisualBasic.FileIO 中找到的 FileSystem.CopyFile() 方法。

FileSystem.CopyFile(fileName, fileDirectory +"\\" + attachments.Name, UIOption.AllDialogs);

运行良好。但是,我需要知道用户在对话框中做出了什么选择。如何捕获用户是否选择了“复制并替换”、“不复制”、“复制并保留两个文件”?

在此处输入图像描述

I have an MVC3 C#.Net web app. In my HTML View, I am using the standard Windows file input

<input style="border:thin solid #ccc;width:270px; background-color: #FFFFFF;" type="file" name="Name" id="Name"/>

In the Controller I am using the FileSystem.CopyFile() method found in Microsoft.VisualBasic.FileIO.

FileSystem.CopyFile(fileName, fileDirectory +"\\" + attachments.Name, UIOption.AllDialogs);

It's working fine. However, I need to know what selection the user makes on the dialog box. How can I trap whether the user has selected "Copy & Replace", "Don't Copy", "Copy and Keep both files"?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枕花眠 2025-01-01 22:56:59

您不能这样做,对话框会处理此问题并且不会返回所选选项。您可能需要重新考虑这一点。一个选项是创建您自己的“复制文件”对话框。

You can't do this, the dialog takes care of this and doens't return the chosen option. You might want to rethink this. An option would be to create your own "Copy File" dialog.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文