There is no single way to do this, in the case of a file upload, there are many extensions that provide a progress bar. If you have a lengthy proces to do, you could use ajax to do the work in the background, and make it update a progress bar using JS.
TKS very much. Extensions are too much complicated and need a lot of resource, I just need a simple one.
I think about this way much time. However, I am a little confused. [b] I just want to konw how these actions communicate with each other.
[/b]
Maybe I should put these methods into the model class. I am not sure.
Thank you in advance.
class FileController extends Controller {
/*
* ajax function: return how many files are handled now
* get the progrss of the check file action
* just need to know the current count and file number
*/
public function actionCheckFileStatus(){
//I just want to know how to get $count from other function
}
/*
* ajax function start the check file progree
* check image files and update them if needed
* it takes a lot of time to check the image files
*/
public function actionCheckFile($fileList){
$count = 0;
foreach ( $file as $fileList ){
//do some check and update here
$count++;
}
}
}