[英]Progress bar MVC 4 Save uploaded file to Database
I'm Writing application where I must upload CSV file to blob -azure cloud- then I show the file content to a user to get some configuration like Columns Names, types and select Columns to be Inserted into the database. 我正在编写应用程序,必须将CSV文件上传到blob -azure cloud-,然后向用户显示文件内容,以获取一些配置(如列名称,类型和选择要插入数据库的列)。
My Question : I get the file from the cloud as a stream I want make progress bar work while Saving to Database, any ideas about how to do that ?! 我的问题:我想以流的形式从云中获取文件,我希望在保存到数据库时使进度条正常工作,有关如何执行此操作的任何想法?
Thanks in Participation. 感谢参与。
I tried using session variable and Ajax Jquery to read get the percentage but it is not working in debugging time. 我尝试使用会话变量和Ajax Jquery读取获取百分比,但它在调试时不起作用。
In order to show the progress of an upload I would suggest using a third party library that has this functionality 为了显示上传的进度,我建议使用具有此功能的第三方库
Here is an example of such a plugin: http://blueimp.github.io/jQuery-File-Upload/ I've used this previously and it works well. 这是一个这样的插件的示例: http : //blueimp.github.io/jQuery-File-Upload/我以前使用过它,并且效果很好。
Concerning this: 关于此:
I want make progress bar work while Saving to Database
我想在保存到数据库的同时使进度条工作
I'm assuming this is a very big file, a small file of just a few thousand lines could probably be saved without the user noticing a delay (once it is uploaded) and you probably don't need to worry about showing a progress bar as it will be done almost instantly. 我假设这是一个很大的文件,可能会保存一个只有几千行的小文件,而无需用户注意延迟(一旦上传),您可能不必担心显示进度栏因为它将几乎立即完成。
If this is not the case I would probably try to do something along the lines of the upload returning a unique ID to the client for the file they uploaded and then this id is used to make a separate AJAX query where you return the progress to the end user. 如果不是这种情况,我可能会尝试执行上载操作,为客户端上传的文件返回唯一ID,然后使用该ID进行单独的AJAX查询,在此将进度返回到最终用户。
The idea would be 这个想法是
I used SignalR to update ProgressBar and it is Working Fine, check this link for More Information. 我使用SignalR更新了ProgressBar,并且工作正常,请查看此链接以获取更多信息。
http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/introduction-to-signalr http://www.asp.net/signalr/overview/signalr-20/getting-started-with-signalr-20/introduction-to-signalr
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.