I have an upload form, where I upload csv files and then insert all rows to the database. If I hit refresh, all content is inserted again and again into the database. What is the best prectice to prevent this?
Thanks a lot! BR
I have an upload form, where I upload csv files and then insert all rows to the database. If I hit refresh, all content is inserted again and again into the database. What is the best prectice to prevent this?
Thanks a lot! BR
The best way to prevent this behavior is to use a redirect to show the landing page. When a redirect is made the browser history records another url after the post action. in Yii you can achieve this by doing the following from the controller.
$this->redirect("../path/to/action");