ASP.NET 在后台上传文件(BITS/AJAX?)

发布于 2024-09-15 09:21:52 字数 231 浏览 5 评论 0 原文

我有一个网页,用户可以在其中创建数据库记录并选择他们想要上传到数据库服务器的文件。这些文件可能很大,例如 100mb。

我不想让用户等待,所以我希望文件在后台上传。这样他们就可以在上传文件的同时继续做其他事情。

BITS 是解决这个问题的方法吗?或者说这只是为了 Fatclient 开发?有什么好的教程 ?

如果 BITS 不是可行的方法,我有哪些选择?使用文件位置对服务进行 ajax 调用?

I have a webpage where users can create a database record and select a file they want to upload to the database server. these files can be big, like 100mb.

I dont want the user to wait, so I want the file to be uploaded in the background. So that they can continue with doing other stuff while the file is being uploaded.

Is BITS the way to go for this? Or is that only for Fatclient development? Any good tuterials
?

If BITS is not the way to go, what are my options? An ajax call to a services with the filelocation?

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

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

发布评论

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

评论(3

往昔成烟 2024-09-22 09:21:52

如果您说“他们可以继续做其他事情”,意思是他们可以在同一网页上执行其他 Ajax 请求(即不离开该网页),那么您可以使用任何基于 Flash 的上传器(SWFUpload很多)。除了一些 JavaScript、 和嵌入式 Flash 上传器之外,这不需要任何东西。

如果您希望用户能够离开启动上传的页面,那么您实际上无法在浏览器中执行此操作,至少要等到 WebSockets 已在所有浏览器中完全实现。即便如此,这也会非常困难。

If you, by saying "they can continue with doing other stuff", mean that they can do other Ajax requests on the same web page (i.e. not navigating away from it), you can accomplish this with any Flash-based uploader (SWFUpload is one of many). This doesn't require anything but some JavaScript, an <input type="file"> and the embedded Flash uploader.

If you want the user to be able to navigate away from the page initiating the upload, you can't really do it within the browser, at least not until WebSockets are fully implemented in all browsers. Even then, it's going to be quite hard.

猛虎独行 2024-09-22 09:21:52

我认为 BITS 不会为你解决问题。我从未使用过它,但似乎无法通过 Web 应用程序访问它 - 它似乎更适合 Windows 客户端应用程序或 Windows 服务。

您可能需要考虑 Andrew Valums AJAX 上传控件 (http://valums.com/ajax-upload/< /a>) 或 Uploadify (http://www.uploadify.com/)。这些都是 jQuery AJAX 控件(并且 uploadify 需要 Flash)。我使用 jQuery 进行 Web 应用程序开发,因此我偏爱这些控件。我已经在几个项目中使用了 Valums 的上传控件,效果非常好。由于 Flash 要求,我没有在实际生产应用程序中使用 uploadify(但它看起来非常好)。我确信还有其他适用于其他 JavaScript 框架的 AJAX 上传工具。

我希望这有帮助!

I don't think BITS will do the trick for you. I've never used it, but it doesn't seem that it can be accessible via a web application - it seems more suited for a windows client app or windows service.

You may want to consider either Andrew Valums AJAX Upload control (http://valums.com/ajax-upload/) or Uploadify (http://www.uploadify.com/). These are both jQuery AJAX controls (and uploadify requires Flash). I work with jQuery for web application development, so I'm partial to these controls. I've used Valums' upload control for several projects and it works very well. I haven't used uploadify in an actual production application because of the Flash requirement (but it looks very nice). I'm sure there are other AJAX upload tools for other JavaScript frameworks.

I hope this helps!

倾城°AllureLove 2024-09-22 09:21:52

我知道这篇文章有点旧,但我也遇到了同样的问题。我的解决方法是使用一个小的弹出窗口,该窗口仅包含文件上传控件和参数来确定文档的存储位置。用户可以从小弹出窗口上传文件,在上传时,可以继续在原始浏览器窗口上浏览任何他们想要的位置,因为他们永远不会真正离开。只是为同一条船上的其他人着想。

I know this post is a bit old but I was having the same issue. My work around is to use a small pop-up window that only incorporates the file upload controls and parameters to determine where the documents should be stored. The user can upload the file from the small popup window and while it is uploading, continue to browse anywhere they wish on the original browser window because they will never actually leave. Just a thought for others in the same boat.

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