Having a controller like the following:
Class Upload extends Controller{
private $up_count = 0;
public function action_tmpupload()
{
if($this->up_count == 0)
{
//empty a session variable
}
//some more coding to save data into a session variable
$this->up_count++;
return true;
}
}
I keep wondering what am I doing wrong as the $up_count variable won’t increase its value, it always stays 0.
What am I missing?
The problem is you set the variable to 0.
Then next time your controller is run… You set the variable to 0 again!
You need to save the up_count variable in the users session – and retrieve the up_count from that same session