ASP.NET文件上传-动态文件名

发布于 2024-07-13 17:03:12 字数 140 浏览 5 评论 0原文

我有一个网页,其中有一个 ASP.NET 文件上传控件,用于将文件从客户端计算机上传到服务器。现在我想上传 n 次。例如:我想从本地电脑上传 100 个文件到服务器。我可以从程序中的Excel文件中读取100个文件名。但是有什么方法可以将此文件分配给文件上传控件吗?

I have a web page where i have an ASP.NET file upload control to upload files from client machine to Server.Now i want to do the uploading n number of times.Ex : I want to upload 100 files from my local pc to server.The 100 file names i can read from an excel file in my program.But is there any way to assign this file to the file upload control ?

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

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

发布评论

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

评论(4

香橙ぽ 2024-07-20 17:03:12

不,作为一项安全功能,FilUpload 控件不允许您设置要下载的内容(想象一下,如果您登录到一个网站,并且它被设置为上传密码文件或其他内容)。

现在可能有另一个控件,或者一种围绕此进行编码的方法,但 FileUpload 控件不允许这样做。

我建议使用 jQuery 多文件上传器 它可以处理用户界面(如果您需要的话)。 实际上传使用免费 ASP 上传,它负责实际的文件传输。 虽然听起来您正在以编程方式管理程序,所以您可以跳过多重操作,只使用免费的 ASP 上传。

No, as a security feature, FilUpload controls do not allow you to set what to download (imagine if you sign on to a website, and it is set to upload a passwords file or something).

Now there is probably another control, or a way to code around this, buut the FileUpload control will not allow it.

I would recommend using the jQuery Multifile Uploader which would take care of a UI (if you need one). And the actual uploads with Free ASP Uploads which takes care of the actual file transfer. Though it sounds like you are tkaing care of the programs programatically, so you can skip the multifule and just work with free asp upload.

蔚蓝源自深海 2024-07-20 17:03:12

您必须制作自己的 Flash 对象或其他东西来完成此操作,基本的 HTML/ASP.Net 控件不会让您做您想要的事情。

You'll have to make your own Flash object or something to accomplish this, the basic HTML/ASP.Net controls won't let you do what you're looking for.

一曲爱恨情仇 2024-07-20 17:03:12

这将需要创建某种活动的或可安装控件。 为了绕过这样做的安全漏洞,您最终必须能够在计算机上执行代码来选择和上传文件。

那时,您是特定于平台的,所以...

我强烈建议您不要尝试让网站自动为您上传文件,而是创建一个 WinForms 实用程序来完成此任务并在任何地方上传文件需要,通过网络服务与网站进行通信等。

This will require creating some kind of an active or installable control. In order to get around the security hole of doing this, you're ultimately going to have to be able to execute code on the machine to select and upload the file.

And at that point, you're platform specific, so...

I would strongly suggest that instead of trying to have a web site automatically upload files for you, that you make a WinForms utility to accomplish this task and upload the files wherever you need, communicate with the web site over web services, etc.

诗化ㄋ丶相逢 2024-07-20 17:03:12

这是一项安全限制,您无法编写上传框的文件选择脚本,因为这将允许黑客编写脚本来窃取您计算机上的文件。

您可以使用这个 silverlight 上传实用程序,这是我的“有机会时使用的东西”列表。

它有一个漂亮的用户界面,支持一次上传多个文件。 我最初对它进行了一些研究,为我们引用的一个摄影网站找到了它,但该项目失败了。

无论如何,该项目可以在这里找到:

它还包含完整的源代码,因此即使控件的开发人员放弃它,您仍然可以选择自己编辑它。

This is a security restriction, you cant script the file selection of an upload box as it would allow hackers to write scripts to steal files off your computer.

You could use this silverlight upload utility which is my list of "things to use when I get the chance".

It has a nice UI and supports uploading many files at once. I originally tracked it down doing some research for a photography website that we were quoting for but that project fell through.

Anyway the project can be found here:

It also has full source code included so even if the control's developers abandon it you still have the choice to edit it yourself.

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