Programmatically set name of file to upload in webpage(以编程方式设置要在网页中上传的文件名)
问题描述
有没有办法以编程方式设置要从网页上传的文件的名称?我怀疑浏览器安全限制使这不可能,但我希望有人能证明我错了.
Is there a way to programmatically set the name of a file to be uploaded from a web page? I suspect that browser security restrictions make this impossible, but I'm hoping someone will prove me wrong.
我有一个需要让管理员上传 HTML 的 Web 应用程序.管理员选择 HTML 文件,然后应用程序上传该文件,并找出所有支持文件(图像、样式表等)并上传它们.似乎没有办法以编程方式从网页上传支持文件,因为用户必须明确指定每个文件.
I have a web application that needs to let the administrator upload HTML. The admin selects the HTML file, then the app uploads that file, plus figures out all the supporting files (images, stylesheet, etc) and uploads them too. There doesn't seem to be a way to programmatically upload the supporting files from a web page, since the user has to specify each file explicitly.
目前我有一个单独的 Windows 应用程序来执行此操作,但最好将此功能与应用程序的其余部分集成.我的后端是带有 C# 的 ASP.NET.
Currently I have a separate Windows app to do this, but it would be ideal to have this functionality integrated with the rest of the app. My back end is ASP.NET with C#.
推荐答案
无法通过浏览器以编程方式从用户计算机中抓取文件.如果网站只能抓取东西,这将违反安全规定.
There is no way to programatically grab files from a user's computer via the browser. This would be a security violation if a website could just grab things.
这篇关于以编程方式设置要在网页中上传的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:以编程方式设置要在网页中上传的文件名


- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 输入按键事件处理程序 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04