ASP.NET Uploading files in the background (BITS/AJAX?)

泪湿孤枕 提交于 2019-12-08 05:02:37

问题


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?


回答1:


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.




回答2:


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!




回答3:


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.



来源:https://stackoverflow.com/questions/3555292/asp-net-uploading-files-in-the-background-bits-ajax

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!