Codeigniter CSRF valid for only one time ajax request

前端 未结 9 888
鱼传尺愫
鱼传尺愫 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 12:11

    Edit the config:

    $config['csrf_exclude_uris'] = ['controller/method'];
    

    Array can include all whitelisted controllers/methods you want the csrf protection to be disabled for.

    The array can also handle regular expressions such as:

    $config['csrf_exclude_uris'] = array(
                                            'api/record/[0-9]+',
                                            'api/title/[a-z]+'
                                    );
    

    For more information visit Codeigniter Documentation - Security Class

提交回复
热议问题