简体   繁体   English

在silverlight(C#)上传文件到web服务器

[英]Uploading file(s) to webserver in silverlight (C#)

Alright, so i have a silverlight application, 好吧,所以我有一个silverlight应用程序,

it opens a filedialog, gets the selected file, transfers it to asp.net which saves it to the server, but i want to know how to implement a progress bar for it. 它打开一个filedialog,获取所选文件,将其传输到asp.net,将其保存到服务器,但我想知道如何为它实现进度条。 for big files, and multiple file uploads, i will need to know the progress of the file upload to the server, is this possible? 对于大文件和多个文件上传,我需要知道文件上传到服务器的进度,这可能吗?

You will probably save yourself a lot of time and heartache by just integrating this Silverlight File Upload codeplex project into your app. 只需将此Silverlight文件上载 codeplex项目集成到您的应用程序中,您就可以节省大量时间和心痛。

You can't actual get good progress information from the standard WebRequest or WebClient components. 您无法从标准WebRequestWebClient组件中获得实际的良好进度信息。 Not only do they not send any of the Request stream until your code has finished writing to it (a decision I can't begin to understand), it doesn't provide any progress events once it starts sending it. 它们不仅不会发送任何请求流,直到您的代码完成写入(我无法理解的决定),它一旦开始发送它就不会提供任何进度事件。 For reasons I can't begin to fathom you can get progress events when sending a string, go figure. 由于我无法理解的原因,你可以在发送字符串时获得进度事件。

I can only guess that these limitations arise from Silverlight needing to operate in multiple browsers and therefore the interface to the Browser HTTP transport is kept as basic as possible. 我只能猜测这些限制是因为Silverlight需要在多个浏览器中运行,因此浏览器HTTP传输的接口尽可能保持基本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM