FileSystem.CopyFile 用户操作
我有一个 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"?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您不能这样做,对话框会处理此问题并且不会返回所选选项。您可能需要重新考虑这一点。一个选项是创建您自己的“复制文件”对话框。
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.