Codeigniter CSRF valid for only one time ajax request

前端 未结 9 871
鱼传尺愫
鱼传尺愫 2020-12-03 11:46

I want to upload image on the server on change event of jQuery but using codeigniter csrf I am able to upload image only one time. How can I upload images using ajax for mul

9条回答
  •  南方客
    南方客 (楼主)
    2020-12-03 11:52

    You can set this in config.php

    $config['csrf_regenerate'] = FALSE;
    

    so the csrf protection is valid during all the session time it will solve your problem. If you set $config['csrf_regenerate'] = true; then CI generate new csrf token every request so your old csrf token not match with new generated csrf token

提交回复
热议问题