代码运行时刷新页面 [英] Refreshing a page while code is running

查看:71
本文介绍了代码运行时刷新页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我目前有一些问题。



我有一个程序当用户选择要上传到数据库的zip文件时,解压缩文件,读取所有文本文件,然后删除文件。



问题我有问题是文本文件是每个文本文件高达300kb,所以由于数据量的原因,过程很慢。



过程如下

用户选择文件

选择文件后单击按钮更新数据库

单击按钮后运行的进程为

将文件解压缩到保留文件夹。

然后将.txt文件读取更改为.old,一旦读取所有文件,它们就会被删除。



如何在屏幕上向我的用户显示进程正在运行并且每隔30秒或在读取文件之后已经更新了x个记录数量?

解决方案

您可以根据文件大小显示上传进度,但是根据文件内容上传进度(比如进行了多少行)?我不会说不可能,但这需要很多工作。查看这篇文章

ASP.NET文件上传进度条 [ ^ ]

Hi

I am currently having a bit of an issue.

I have a program that when a user select a zip file to upload to the database, the file is unzipped all the text files are read and the files then deleted.

Problem i am having is the text files are huge upto 300kb per text files so naturally the process is slow because of the quantity of data.

the process is as follows
User selects a file
once the file is selected clicks a button to update the database
the process that runs once the button is clicked is
the files get unzipped to a holding folder.
the .txt files are then read changed to .old and once all the files have been read they are deleted.

How could i show my users on the screen that the proccess is running and x amount of records have been updated after either every 30seconds or after a file has been read?

解决方案

You could show the upload progress based on file size but upload progress based on file content(like how many lines progressed)? I won't say impossible but that'll take lot of work. Check this article
ASP.NET File Upload with Progress Bar[^]


这篇关于代码运行时刷新页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆